Jump Game - Company-specific OAs / Microsoft OA

https://algo.monster/problems/jump_game

public static HashSet visited = new HashSet<>();
public static boolean jumpGame(List arr, int start) {
// WRITE YOUR BRILLIANT CODE HERE
if (visited.contains(start)) return false;
if (start < 0 || start >= arr.size()) {
return false;
}
if (arr.get(start) == 0) {
return true;
}
int nextIndex = arr.get(start);
visited.add(start);
return jumpGame(arr, start - nextIndex) || jumpGame(arr, start + nextIndex);
}