Algorithm · Uber · Easy
Alex is walking through a shopping mall that consists of a row of n stalls. Every stall sells exactly one item, and the prices are given in a non-decreasing array prices where prices[i] is the cost of the item at stall i + 1 (1‑indexed). Alex can buy at most one item from any stall. You are given q queries, described by two arrays pos and amount, each of length q. For each query j, Alex starts at stall pos[j] (1‑indexed) and then visits every stall from pos[j] through n in…
Checking your access…