• + 2 comments

    Addition needs to be done at a and subtraction at b+1. Also,avoid memset on hackerrank sometimes it doesn't work fine. Lastly,the final loop would run till <=n.