leetle

Daily challenge for 2026-06-22

538. Warehouse Box Weight Reduction

You are given a string of digits representing the weights of boxes on a conveyor belt. A robotic arm follows a specific protocol: if it sees a box that is strictly lighter than the box immediately preceding it, it removes the lighter box and the one before it, then re-evaluates the belt. This process continues until no more boxes can be removed. Return the final string of weights remaining on the belt.

Example:
Input: weights = "1232"
Output: "12"
Explanation: 3 is followed by 2 (2 < 3), so '32' is removed. Remaining is "12". No more removals possible.

Run this challenge interactively in Python or JavaScript when the app loads.