InterviewDB
Question
Most Powerful Card: Find the Card Combination Maximizing Attack Under a Mana Cap
Question Details
Problem You have a collection of cards. Each card has a mana_cost and an attack_power. You can play cards whose total mana cost does not exceed max_mana. Maximize total attack power. Return the maximum total attack power achievable. Example: Approach This is the 0/1 knapsack problem. Each card can be played at most once. Follow-ups What is the time and space complexity of this DP solution? What if cards can be played multiple times (unbounded knapsack)? How does the DP direction change? Add a co…
Full Details
🔒
Unlock all Karat questions
Full insider details, leaked discussions, and candidate experiences.
or every company, $100/year →About This Question
This is a reported interview question from a karat interview.
It covers the following topics: Coding, Backtracking, Dynamic Programming .