3rd test case is not satisfied
Your Mistake
correct the entry condition of while loop
your condition: while(sr<er & sc<ec){
correct condition: while(sr<=er & sc<=ec){
Modified code
Your Mistake
correct the entry condition of while loop
your condition: while(sr<er & sc<ec){
correct condition: while(sr<=er & sc<=ec){
Modified code