FastPrepMaximum Game Score with Fixed Forward Jumps
Problems/Maximum Game Score with Fixed Forward Jumps

Maximum Game Score with Fixed Forward Jumps

Stripe logoStripe● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Stripe new grad online assessment. The task was to pick a starting index in an array, keep jumping forward by exactly k, and get the largest possible sum of the values you land on.

The report does not say whether the player may stop before the end, and it gives no limits. Here, the walk always goes on until the next jump would leave the array, since the only choice is where to start. We use up to 10^5 values between -1000 and 1000, with k from 1 to n - 1.

Our version is about 95% the same as the reported question.

You are given an integer array gameVal of length n and an integer k.

A player picks any index as the starting position. From index i, the player jumps forward exactly k positions to index i + k, and keeps jumping this way while the new index is inside the array. The walk ends only when the next jump would leave the array, so the player cannot stop early.

The player's score is the sum of the values at every visited index, including the starting index.

Return the maximum score the player can get by choosing the best starting position.

Function

maxGameScore(gameVal: int[], k: int) → int

Examples

Example 1

gameVal = [2,-3,4,6,1]k = 2return = 7
  • Start at index 0: visit 0 -> 2 -> 4 for 2 + 4 + 1 = 7.
  • Start at index 1: visit 1 -> 3 for -3 + 6 = 3.
  • Start at index 2: visit 2 -> 4 for 4 + 1 = 5.
  • Start at index 3 or 4: the next jump leaves the array, so the scores are 6 and 1.
  • The best score is 7.

Example 2

gameVal = [-2,5,-6,3,-1]k = 1return = 2
  • With k = 1, each start walks to the end of the array.
  • The scores for starts 0 to 4 are -1, 1, -4, 2 and -1.
  • Starting at index 1 collects 5 first, but the walk must go on through -6, 3 and -1, which leaves 1.
  • The best score is 2, from index 3: 3 + (-1) = 2.

Example 3

gameVal = [-5,-1,-3,-2]k = 2return = -2
  • Start at index 0: -5 + (-3) = -8. Start at index 1: -1 + (-2) = -3.
  • Start at index 2: -3. Start at index 3: -2.
  • Every score is negative, and the best one is -2.

Constraints

  • n == gameVal.length
  • 2 <= n <= 10^5
  • -1000 <= gameVal[i] <= 1000
  • 1 <= k <= n - 1

More Stripe Online Assessment questions

  • Asynchronous Event ProcessingOA · Seen Nov 2026
  • Reliable LLM Call with Independent Retry BudgetsOA · Seen Nov 2026
  • Request Routing SystemOA · Seen Nov 2026
  • Financial Account LedgerOA · PHONE SCREEN · Seen Nov 2026
  • Chat Billing CalculationOA · Seen Nov 2026
  • Deployment Window SchedulerOA · Seen Nov 2026
  • Subscription and Usage-Based Billing CalculatorOA · Seen Nov 2026
  • Split Tender Part 4 - RefundsOA · PHONE SCREEN · Seen Nov 2026
  • Incident MonitorOA · Seen Nov 2026
  • Split Tender Part 3 - SurchargesOA · Seen Nov 2026

Similar questions at other companies

  • Minimize Sum of Distances to WarehousesAmazon · OA
  • Maximum Apples from Two Disjoint Fixed-Length SegmentsMarshall Wace · OAMarshall Wace interview questions
  • Maximum Non-Decreasing Array LengthVisa · OAVisa interview questions
  • Maximize CollaborationTikTok · OATikTok interview questions
  • Maximum Sum RectangleDeloitte · OADeloitte interview questions
  • Maximum Subarray Sum with Equal EndpointsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Maximum Subarray SumCapital One · PHONE SCREEN · ONSITE INTERVIEWCapital One interview questions
  • Minimum Variance Sum SplitAirbnb · PHONE SCREENAirbnb interview questions
  • Largest All-One Square Area and CountNVIDIA · PHONE SCREENNVIDIA interview questions
  • Most Visited Sprint MarkerMicrosoft · OAMicrosoft interview questions

Interview reports that mention this question

  • Stripe New Grad SWE OA and Phone Screen: 2 Experiences

Stripe interview experiences

  • Stripe Experienced SWE OA and Onsite Questions: 3 Experiences
  • Stripe SWE Intern Linked Merchants Team Screen: 1 Experience
  • Stripe OA: What It Tests (2026)
  • Stripe SWE Onsite over Two Days: 1 Experience
  • Stripe New Grad SWE Phone Screen and Onsite: 2 Experiences
All Stripe interview questionsSee Stripe hiring insights
Saved
class Solution {
    public int maxGameScore(int[] gameVal, int k) {
        // Write your code here.
    }
}
Checking account…