yes, i think that's a valid way of looking at it - the grid adds some extra properties to a general graph which you might be able to exploit to get better efficiency.
[but i don't really want to spoil things for quora by discussing a solution here, i was more interested in swapping final results so that people could check they have the right answer]
ps i believe my solution is ok, now, after checking it at lunch time, but it's a little slower than theirs, which is making me think i have missed something.