Automated Package Sorting System

Medium2s max execution

You work for an automated warehouse. Your task is to implement a system that sorts incoming packages into different bins based on their dimensions and weight.

📦 Rules:

  1. A package is considered BULKY if:
    • Volume (width × height × length) is ≥ 1,000,000 cm³
    • OR any dimension is ≥ 150 cm
  2. A package is considered HEAVY if its mass is ≥ 20 kg
  3. Packages must be sorted into these categories:
    • STANDARD : Neither bulky nor heavy
    • SPECIAL : Either bulky or heavy (but not both)
    • REJECTED : Both bulky and heavy
Complete the sort() method in the PackageSorter class to return the appropriate category.

Examples:

Input: [50, 50, 50, 15]
Output: "STANDARD"

Volume: 125000, Mass: 15 kg -> STANDARD

Input: [100, 100, 100, 15]
Output: "SPECIAL"

Volume: 1000000, Mass: 15 kg -> bulky so SPECIAL

Input: [50, 50, 150, 15]
Output: "SPECIAL"

One dimension is 150 -> SPECIAL

Input: [50, 50, 50, 20]
Output: "SPECIAL"

Mass: 20 kg -> heavy so SPECIAL

Input: [150, 150, 150, 20]
Output: "REJECTED"

Both bulky and heavy -> REJECTED

Constraints:

  • • Dimensions and mass are positive numbers.
  • • Dimensions in cm, mass in kg.
Loading...

Custom Test Input

Output

Run your code to see output...