Why am I failing in 3 test cases?

I guess I have applied the correct logic. But still I am failing half of the test cases. Please help me with my code.
link: https://ide.geeksforgeeks.org/xa9MAuEgQB

hey @ayushjain.aj300, in line no 6, j==m-1 instead of j==n-1. Please correct this one.

I am so sorry to bother you for such silly mistake. Thanks for the help though,Sir. :slight_smile:

hey @ayushjain.aj300 , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved