Permutation Shop
Alice and Bob are visiting a shop with $N$ different items arranged in a row. The shop is represented by a permutation $P$ of the numbers $[1, 2, \ldots, N]$, where $P_i$ denotes the price of the $i$-th item from the left. There is an **infinite supply** of each item. Both Alice and Bob have $K$ coins. - Alice starts from the **left** and moves right. At each item, if she can afford it and hasn'
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start