Practice Solving Questions With Brainpower
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed 2D integer array questions where questions[i] = [pointsi, brainpoweri]. The array describes the questions of an exam, where you have to process the questions in order (i.e., starting from question 0) and make a decision whether to solve or skip each question. Solving question i will earn you pointsi points but you will be unable to solve each of the next brainpoweri questions. If you skip question i, you get to make the decision on the next question. Return the maximum points you can earn for the exam.
Source: Solving Questions With Brainpower on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
questions = [[3,2],[4,3],[4,4],[2,5]]
5
# Example 2
questions = [[1,1],[2,2],[3,3],[4,4],[5,5]]
7
Constraints
Related LeetCode Problems
Practice more problems similar to Solving Questions With Brainpower.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.