Books and Friends
CodeChefOpen on judge ↗
Rishi wants to collect some books. He wants to buy the **maximum** possible number of books so that he can study. Now, you have to help him by selecting the shops from the given $N$ book shops (The selected shops should be continuous). There are $N$ continuous shops (from $1$ to $N$) and the $i^{th}$ shop is having an integer $A[i]$. - If $A[i]$ is positive, he can buy $A[i]$ number of books
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