CloudKaptan Interview Question

Java array, 2d questions on traversal