You are viewing a single comment's thread. Return to all comments →
can you explain the logic behind
if(b!=n) arr[b+1]-=k; } for(int i=1;i<=n;i++) { sum+=arr[i]; if(sum>ans) ans=sum; }
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
can you explain the logic behind
if(b!=n) arr[b+1]-=k; } for(int i=1;i<=n;i++) { sum+=arr[i]; if(sum>ans) ans=sum; }