I have my own solution and wanted to check it against something online but couldn't find any examples. How would you solve this one. (I can post my code if necessary). I just want to see if someone has a better approach that I didn't think of or if my code misses any edge cases. This is for practice for a programming interview. I've written it in Java so I'd prefer to see other code in Java but any language would be fine- or even just an english explanation of what you'd do if you don't want to actually code it (but I'd prefer code since you might not realize certain things that you'd realize once you started coding).
The grid is represented by a 2d array.