BackmediumArrays Uber Oracle

Warehouse Inventory Management Solution

Problem Statement

Design a WarehouseManager class to manage the inventory of crates in a warehouse. The class should have methods to addCrates and removeCrates from the inventory, and to getHighestPriorityCrates without removing them. The priority of a crate is determined by its value, with higher values indicating higher priority.

Example 1
Input
[91, 85, 65, 24, 100, 50, 75]
Output
[100, 91, 85]

Explanation: Step-by-step: 1. Initialize an empty list to store the highest priority crates. 2. Sort the input list in descending order based on the crate values. 3. Return the sorted list as the highest priority crates.

Example 2
Input
[100, 50, 75, 25, 90, 85, 65]
Output
[100, 90, 85]

Explanation: Step-by-step: 1. Initialize an empty list to store the highest priority crates. 2. Sort the input list in descending order based on the crate values. 3. Return the sorted list as the highest priority crates.

Constraints

  • At most 10^4 crates are added to or removed from the inventory.
  • The value of each crate is between 1 and 10^5.
Live Compiler
Loading...
Test Cases & Output
🔒 Sign up to run your code

🚀 Practice this problem

Run code, get AI hints & track streak

Sign Up Free