← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given an array of integers representing order IDs. An order is eligible to be processed if its value is strictly greater than both of its immediate neighbors (a local peak). On each simulation step you must identify every eligible order, select the one with the smallest ID, remove it from the array, and then recalculate eligibility for the remaining orders. Repeat this process until no eligible orders remain. Return the sequence of order IDs in the order they were removed.