Reference: https://apcentral.collegeboard.org/media/pdf/ap24-frq-comp-sci-a.pdf
Topics:
Conditionals
Objects
2D Array
While loop or recursion
This would be a good problem for 2D Arrays
Part A:
Create helper functions to make comparing things easier
Create an isValidPosition function to take 1 Location object and determine whether it's on the grid. Return true if it is, false otherwise. Use this function in getNextLoc to make your conditions shorter and more readable.
Have a condition in getNextLoc that checks for both positions being invalid. Return null if it is.
Part B:
Try solving part B recursively...