Skip to content

Maximizing Points in the "Solving Questions With Brainpower" Problem #34

Answered by iamAntimPal
Antim-IWP asked this question in Q&A
Discussion options

You must be logged in to vote
class Solution:
    def mostPoints(self, questions: List[List[int]]) -> int:
        @cache
        def dfs(i: int) -> int:
            if i >= len(questions):
                return 0
            p, b = questions[i]
            return max(p + dfs(i + b + 1), dfs(i + 1))

        return dfs(0)

for more information go to click on me

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Antim-IWP
Comment options

Antim-IWP Apr 1, 2025
Collaborator Author

Answer selected by Antim-IWP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants