i is described by tasks[i] = [points, rest]: solving it earns points points, but the next rest tasks are burned and can no longer be solved. A task may also be skipped, in which case the contestant moves straight on to the next one.
Return the maximum total score the contestant can earn.tasks=[[6, 1], [5, 1], [7, 2], [3, 1]] → 13
Solve task 0 (+6) and sit out task 1, then solve task 2 (+7), which burns task 3. That makes 13, and no plan does better.
tasks=[[2, 5], [9, 1], [4, 1]] → 9
It pays to skip task 0 and take task 1 for 9 points (task 2 is then off-limits).
tasks=[[4, 3]] → 4
tasks[i] has exactly two numberstasks=[[6, 1], [5, 1], [7, 2], [3, 1]]
13
Run checks the first 3 tests in your browser. Submit checks all 103 tests on the server, hidden ones included.