Skip to content

2140. Solving Questions With Brainpower #1505

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

We need to maximize the points we can earn from solving exam questions, given that solving a question prevents us from solving the next few questions as specified by its brainpower value. This problem can be efficiently tackled using dynamic programming.

Approach

  1. Dynamic Programming (DP) Setup: We use a DP array where dp[i] represents the maximum points we can earn starting from the i-th question to the end of the exam.
  2. Reverse Iteration: We iterate through the questions from the last to the first. This allows us to build up the solution by considering each question's impact on future questions.
  3. Decision Making: For each question i, we have two choices:
    • Solve the Question: Earn the poin…

Replies: 1 comment 2 replies

Comment options

mah-shamim
Apr 1, 2025
Maintainer Author

You must be logged in to vote
2 replies
@kovatz
Comment options

kovatz Apr 1, 2025
Collaborator

@mah-shamim
Comment options

mah-shamim Apr 1, 2025
Maintainer Author

Answer selected by kovatz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants