• + 0 comments

    wow brilliant but shouldn't it be a[p+1]+=sum; since a is 1-indexed array as per the question