forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_2525.java
25 lines (24 loc) · 879 Bytes
/
_2525.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.fishercoder.solutions;
public class _2525 {
public static class Solution1 {
public String categorizeBox(int length, int width, int height, int mass) {
int dimensionLimit = 10000;
int volumeLimit = 1000000000;
boolean isBulky = false;
long volume = (long) length * width * height;
if (length >= dimensionLimit || width >= dimensionLimit || height >= dimensionLimit || volume >= volumeLimit) {
isBulky = true;
}
boolean isHeavy = mass >= 100;
if (isBulky && isHeavy) {
return "Both";
} else if (!isBulky && !isHeavy) {
return "Neither";
} else if (isBulky && !isHeavy) {
return "Bulky";
} else {
return "Heavy";
}
}
}
}