My first instinct was BFS and that was right, but I spent too long second-guessing myself on the modulo wrapping for leftward jumps.
Model the problem as a shortest path on a graph where each index is a node and edges connect to (i ± arr[i]) mod n. Use BFS to find the minimum number of jumps from start to target, as BFS guarantees the shortest path in an unweighted graph. If BFS exhausts all reachable nodes without finding the target, return -1.
Pro tip: Clarify edge cases upfront: what if start equals target? (return 0) and what if arr[i] is 0? (no moves from that index). Also mention that BFS is optimal here because all edges have equal weight (1 jump).
Confirm the circular nature (wraparound using modulo), that jumps can be left or right, and handle edge cases like start == target (return 0) and arr[i] == 0 (no moves).
Treat each index as a node. From index i, add directed edges to (i + arr[i]) % n and (i - arr[i] + n) % n. This forms an unweighted graph.
Use a queue to perform BFS from the start index, tracking visited nodes and the number of jumps (level). Stop when target is reached or queue is empty.
If target is found, return the jump count; else return -1. Time complexity is O(n) since each node is visited at most once, and space is O(n) for the queue and visited set.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.