2025-08-20 14:57:07 +0000 UTC

Categorize Box According to Criteria

Code

class Solution:
    def categorizeBox(self, length: int, width: int, height: int, mass: int) -> str:
        is_bulky = (
            max(length, width, height) >= 10 ** 4
            or length * width * height >= 10 ** 9
        )
        is_heavy = mass >= 100
        if is_bulky and is_heavy:
            return "Both"
        if is_bulky and not is_heavy:
            return "Bulky"
        if is_heavy and not is_bulky:
            return "Heavy"
        return "Neither"