Skip to content

Commit c4526e9

Browse files
authored
Create Code Testcase Testcase Test Result 2525. Categorize Box According to Criteria.java
1 parent eac4696 commit c4526e9

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)