Skip to content

Commit e265f12

Browse files
Merge pull request #2001 from CodingTestStudy2/염혜정
[염혜정] Day09
2 parents 759e09b + c4526e9 commit e265f12

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// O(1)
2+
3+
class Solution {
4+
public String categorizeBox(int length, int width, int height, int mass) {
5+
boolean bulky = false;
6+
7+
if (length >= 10000 || width >= 10000 || height >= 10000) {
8+
bulky = true;
9+
}
10+
11+
long volume = (long) length * width * height;
12+
if (volume >= 1_000_000_000L) {
13+
bulky = true;
14+
}
15+
16+
boolean heavy = mass >= 100;
17+
18+
if (bulky && heavy) return "Both";
19+
if (bulky) return "Bulky";
20+
if (heavy) return "Heavy";
21+
return "Neither";
22+
}
23+
}

0 commit comments

Comments
 (0)