He is doing
currSum = cumSum[j] - curSum[i-1]
Isn’t it going to create problems for i = 0 i.e. the first iteration?
I mean the elemnt at -1 doesn’t exist!
He is doing
currSum = cumSum[j] - curSum[i-1]
Isn’t it going to create problems for i = 0 i.e. the first iteration?
I mean the elemnt at -1 doesn’t exist!
hello @Prashant-Kumar-1947183015386369
yeah u are right.
handle that case separately using if statement.
ie if i==0 then currSum=cumSum[j].
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.