fix small bug in correctness and loop invariant code
fix small bug in correctness and loop invariant code

rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank