Recall & Review
beginner
What is the main idea behind the Greedy approach?
Greedy approach makes the best choice at each step, hoping to find the overall best solution without reconsidering previous choices.
Click to reveal answer
beginner
What does Dynamic Programming (DP) do differently from Greedy?
DP solves problems by breaking them into smaller overlapping subproblems, solving each once, and storing results to avoid repeated work.
Click to reveal answer
intermediate
When should you use Greedy over DP?
Use Greedy when the problem has the greedy-choice property and optimal substructure, meaning local best choices lead to global best solution.
Click to reveal answer
beginner
What is the optimal substructure property?
A problem has optimal substructure if an optimal solution can be built from optimal solutions of its subproblems.
Click to reveal answer
intermediate
How can you tell if a problem needs DP instead of Greedy?
If the problem has overlapping subproblems and no greedy-choice property, DP is needed to explore all options and store results.
Click to reveal answer
Which property must a problem have for Greedy to work correctly?
✗ Incorrect
Greedy-choice property means local best choices lead to global best solution, essential for Greedy to work.
What does Dynamic Programming use to avoid repeated work?
✗ Incorrect
DP stores results of subproblems using memoization or tabulation to avoid recalculating.
If a problem has overlapping subproblems but also a greedy-choice property, which approach is better?
✗ Incorrect
Greedy is preferred if greedy-choice property holds, even if subproblems overlap.
Which of these problems is typically solved by Dynamic Programming?
✗ Incorrect
Fibonacci has overlapping subproblems and optimal substructure, ideal for DP.
What is NOT a sign that Greedy might fail?
✗ Incorrect
Optimal substructure alone does not mean Greedy fails; it is necessary but not sufficient.
Explain how to decide between using Greedy or Dynamic Programming for a problem.
Think about whether making the best choice now guarantees the best overall solution.
You got /4 concepts.
Describe the key differences between Greedy and Dynamic Programming approaches.
Consider how each approach handles problem parts and solution building.
You got /4 concepts.