• + 0 comments

    I gave custom input as

    10 2 5 7 600 1 4 500

    and i got output as 600

    then my question is when i enter the input for first operation then at a[5]=600 and a[8]=-600 now when i enter the input for second operation then a[1]=500 and a[5] becomes 100 as it was earlier 600(i.e 600-500). can anybody please explain how i got output as 600.