Process questions from left to right. Each entry contains [points, brainpower]. You may skip a question and consider the next one, or solve it to earn its points. Solving index i forces you to skip the following brainpower questions, so the next index you may consider is i + brainpower + 1. If that index is beyond the array, the exam ends. Return the maximum total points you can earn.
Example 1:
Input: questions = [[5,1],[9,1],[5,1]]
Output: 10Explanation: Solve questions 0 and 2. Solving question 0 skips question 1, then question 2 adds another 5 points. The total 10 is better than solving question 1 for 9 points.
Example 2:
Input: questions = [[2,3],[8,1],[1,1]]
Output: 8Explanation: Skip question 0 and solve question 1 for 8 points. Its required skip passes question 2, ending the exam.
Example 3:
Input: questions = [[7,100]]
Output: 7Explanation: Solve the only question for 7 points. A skip extending beyond the end does not remove points already earned.
Constraints:
1 <= questions.length <= 100000- Every entry contains exactly two integers:
[points, brainpower]. 1 <= points, brainpower <= 100000