β back to unit
Medium
# stacks medium
Freight Elevator
Boxes stack up in the freight elevator; the safety inspector wants its heaviest moment of the day. π
You get commands β load:250 (a box of that weight goes on top) or unload (top box off, always valid). Print the maximum TOTAL weight the elevator held at any moment.
Example:
Input: commands = ["load:100", "load:200", "unload", "load:50"]
Output: 300
The total weight climbs to 100, then 300 (the peak), drops to 100 after unloading, then rises to 150 β the highest total ever reached was 300.
π‘ need a hint?
stk-freight-elevator.pyπ given lines are locked β write your code in between
loading...