Back to problems

Warehouse Loading: Reach TargetWeight at Any Point with Reordered +/- Weights

Algorithm · Confluent · Hard

Problem You control a robot on a loading dock. A sequence of N operations is given as an integer array W. If W[i] > 0, the robot loads an item of weight W[i], so the running total increases. If W[i] < 0, the robot unloads weight W[i] , so the running total decreases. The robot begins with a total load of 0. The execution order of the operations is not fixed: you may place all N operations in any order you choose. Decide whether some ordering exists such that, after executing…

Checking your access…