Hostel Room
There are initially $X$ people in a room. You are given an array $A$ of length $N$ which describes the following events: - If $A_i \geq 0$, then $A_i$ people enter the room at $i$-th minute. For e.g. if $A_2 = 3$, then $3$ people enter the room at the $2$-nd minute. - If $A_i \lt 0$, then $|A_i|$ people leave the room at $i$-th minute. Here $|A_i|$ denotes the absolute value of $A_i$. For e.g. i
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