← All problemsSign in

Chef and his Sweet Shop

Chef opened a new sweet shop. His Astrologer predicted for N consecutive days how much sale will he have, he also has to spend a specific amount of money everyday to keep the shop open. Chef believed in the words of astrologer so he decided to keep the shop closed on some days (maybe zero) such that he gets maximum profit. Help chef determine total profit he will have after N days. Note: It does

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