Even after getting the answer right one of my test cases is not passing pls check

@vibhor1007
Your placement of while(t–) was wrong. Also I modified the compare function a bit.

In case you face any difficulty, please feel free to revert.
If my answer was able to resolve your query, please mark the doubt as resolved.