JuniorMath

Categorize Box According to Criteria

Given four integers length, width, height, and mass, representing the dimensions and mass of a box, respectively, return a string representing the category of the box.

  • The box is "Bulky" if:
  • Any of the dimensions of the box is greater or equal to 10^4.
  • Or, the volume of the box is greater or equal to 10^9.
  • If the mass of the box is greater or equal to 100, it is "Heavy".
  • 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 "Bulky" but not "Heavy", then its category is "Bulky".
  • If the box is "Heavy" but not "Bulky", then its category is "Heavy".

Note that the volume of the box is the product of its length, width, and height.

Example 1
Inputlength = 1000, width = 35, height = 700, mass = 300
Output"Heavy"
The box is not bulky because no dimension is at least 10^4 and its volume is at most 10^9, but its mass is at least 100, so it is Heavy.
Example 2
Inputlength = 200, width = 50, height = 800, mass = 50
Output"Neither"
The box is neither bulky nor heavy because no dimension is at least 10^4, its volume is at most 10^9, and its mass is less than 100.

Constraints

  • 1 <= length, width, height <= 10^5
  • 1 <= mass <= 10^3

Asked at 2 companies

</>

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Loading...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, missed edge cases, and complexity analysis of your solution.

Sign in to evaluate