This is my code
Sir In was unable to figure out the two test cases
@Gunit don’t use “if” statement after first “if” instead use “else if” cause your first if will increment dir then it will again become true for second dir and will start printing a[i][dir] from your second if statement but there may be chances that dir becomes >=c and can give your wrong answer here.
Sir I was unable to get the other two test cases