
You are given a sorted array of distinct integers stones representing stone positions in a river, where stones[0] = 0. A frog starts on stone 0; its first jump must be 1 unit. If its last jump was k units, the next jump must be k−1, k, or k+1 units (and must be > 0). Determine whether the frog can reach the last stone. Design and justify an efficient algorithm (e.g., DP with hash sets or maps), including correctness arguments and time/space complexity. Follow-ups: discuss pruning strategies and worst-case inputs.