Oracle Interview Question

Island matrix grid traversal question