Calorie Limit
Sushil is a diabetic patient. He is only allowed to eat **at most** $K$ calories in a day. However, he likes to eat sweets a lot. There are $N$ sweets in front of him. The $i$-th sweet has a calorie count of $A_i$. Sushil will eat the sweets **in order**, i.e. he will start from the $1$-st sweet, then the $2$-nd, then the $3$-rd, and so on. If eating the $i$-th sweet would take him over his d
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