Loading section...
1D DP: Climbing Stairs, Min Cost, House Robber
Concepts: py1DDP, pyHouseRobber, pyMinCostStairs
These three problems are the DP equivalent of fizz buzz. Every interviewer has used them. Master them not because they will appear verbatim, but because they install the DP framework into your thinking. For every 1D DP problem in the interview, you will apply this same process: define dp[i] precisely, write the recurrence, nail the base cases, handle array sizing. Let's run all three through the framework. The Interview Framework for 1D DP Min Cost Climbing Stairs (LeetCode 746) Given an array cost[] where cost[i] is the cost to step off stair i, find the minimum cost to reach the top (one step past the last stair). You can start at stair 0 or stair 1 and can climb 1 or 2 steps at a time. dp[i] = minimum total cost to reach stair i. To reach i, you either came from i-1 (paying cost[i-1]) o