"Java". The code is failing in some of the test cases

Test cases are- 0,2,3 and 5
link to ide- https://ide.codingblocks.com/s/348965

hello @himanshu_goyal please raise your doubt again as your code is in java and i am the C++TA.
some other TA will be help you in the better way.
Happy Learning !!