Categorize Box According to Criteria
Let’s write a function to categorize the box based on the given conditions. Here’s the plan:
- Calculate the volume of the box: Multiply the length, width, and height.
- Check if the box is bulky: The box is bulky if any dimension is greater than or equal to ( 10^4 ), or if the volume is greater than or equal to ( 10^9 ).
- Check if the box is heavy: The box is heavy if the mass is greater than or equal to 100.
- Return the category based on the conditions.
Python solution:
|
|
This code performs simple arithmetic operations and comparisons, so the time complexity is ( O(1) ), and the space complexity is also ( O(1) ).