• + 0 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; }