← All problemsSign in

Mr Perfectionist

Vicky (Mr. Perfect) goes for shopping in a shopping mall with N shops to buy an item X. The shops in the shopping malls are in a single row and numbered from 0 to N-1. Each shop has total stock of Ai of the item X. He already knows the available stocks of X in each shop. He can buy any number of X from a shop. Due to his habit for perfection in every task, he will shop according to the following c

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start