Algorithm · Uber · Hard
You are given an integer array score of length n, along with an integer k. Your journey begins at index 0, and the running total starts equal to score[0]. A move takes you from index i to a strictly larger index j, subject to two conditions: the gap j - i must not exceed k, and that same gap must be a prime number. Whenever you arrive at an index, its score[j] is added to your running total. Determine the largest total you can accumulate upon arriving at index n - 1. If no…
Checking your access…