Infogain Interview Question

Write an algorithm for a 9x9 matrix where you can navigate using ones.