Given four integers length, width, height and mass, representing the dimensions and mass of a box, categorize the box according to the following criteria:
-
The box is "Bulky" if any of its dimensions is greater than or equal to
104
, or its volume (
length * width * height
) is greater than or equal to
109
.
-
The box is "Heavy" if its mass is greater than or equal to 100.
-
If the box is both "Bulky" and "Heavy", then its category is "Both".
-
If the box is neither "Bulky" nor "Heavy", then its category is "Neither".
-
If the box is only "Bulky" but not "Heavy", then its category is "Bulky".
-
If the box is only "Heavy" but not "Bulky", then its category is "Heavy".
Return a string representing the category of the box.
Function Signature
def categorize_box(length: int, width: int, height: int, mass: int) -> str:
Rules
-
The return value is exactly one of
"Both"
,
"Bulky"
,
"Heavy"
or
"Neither"
, spelled and capitalized as shown.
-
Both thresholds are inclusive: a side of exactly 10000, a volume of exactly 1000000000 or a mass of exactly 100 meets its condition.
Constraints
-
1 <= length, width, height <= 10^5
-
1 <= mass <= 10^3
Examples
Input: length = 1000, width = 35, height = 700, mass = 300
Output: "Heavy"
The volume is 1000 * 35 * 700 = 24,500,000, which is below 109, and no side reaches 104, so the box is not Bulky. The mass 300 is at least 100, so it is Heavy.
Input: length = 200, width = 50, height = 800, mass = 50
Output: "Neither"
The volume is 8,000,000 and no side reaches 104, so the box is not Bulky. The mass 50 is below 100, so it is not Heavy either.
Input: length = 1000, width = 1000, height = 1000, mass = 100
Output: "Both"
No single side reaches 104, but the volume is exactly 109, so the box is Bulky. The mass is exactly 100, so it is also Heavy.