why it is giving wrong answer on test case 1 and 3.
@rohit2299 hi,check this commented code and dry run it you will get it: