Get Max Points from Sprints
Learn this problemProblem statement
Amazon Care is a healthcare and wellbeing portal for its employees.
To promote physical fitness, on the portal they launched a "GetFit" tournament consisting of n sprints. Each sprint lasts for a given number of days and includes several tasks such as push-ups, running, etc. Some tasks are scheduled for each day of the sprint. The i-th sprint lasts for days[i] days, and each sprint starts just after the other. That is, if the i-th sprint ends on day d, the (i + 1)-th sprint starts on day (d + 1). During each sprint, completing the required tasks scheduled on the j-th day of the sprint earns the participant j points.
The tournaments are periodic, i.e., as soon as the last sprint of a tournament ends, the first sprint of the next tournament begins. Each tournament, however, has the same schedule of sprints. More formally, the tournament schedule can be considered cyclic in nature and after the last sprint, the first sprint starts again.
An employee decides to participate. However, due to a tight schedule, the employee cannot complete all tasks every day. Instead, the employee will complete the tasks of exactly k consecutive days, hoping to achieve the maximum number of points.
Given the sprint days of n sprints, and the number of days for which the employee competes for k, find the maximum points the employee can score. The training can start and end on any day of any sprint.
Note:
kis guaranteed to be less than the total number of days for which the sprints last.- It is not necessary to start and end the training in the same tournament; the schedule is cyclic, so the chosen window of
kconsecutive days may wrap from the last sprint back into the first sprint. - A sprint here denotes a set of activities performed in a particular time period.
Function
getMaxPointsFromSprints(days: int[], k: int) → intExamples
Example 1
days = [2, 3, 2]k = 4return = 8
Constraints
n == days.lengthn >= 1days[i] >= 1for every sprinti1 <= k < sum(days)
More Amazon problems
- Drone Delivery RouteOA · Seen Aug 2026
- Package Dependency OrderPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
- Unfulfilled Customers by Inventory PriorityOA · Seen Aug 2026
- Calculate Beauty ValuesOA · Seen Aug 2026
- Maximize Distance to the Closest Occupied SeatONSITE INTERVIEW · Seen Aug 2026
- Package Delivery SystemOA · Seen Aug 2026
- Select Least Resource TasksOA · Seen Aug 2026
- Maximum Length-K Window Sum over Sparse SegmentsOA · Seen Aug 2026