It is passing 4/5 test cases, cant figure out the problem?

hello @Ak07


u missed this .
this is done to avoid loop.

also remove check[i][j+1] conditon from ur if statement ,this will give error for case where j=10
because j+1 will be 11 and u cannot acces index 11

check ur corrected code.