14.15 House Robber
14.15.1 Problem Metadata
- Platform: LeetCode
- Problem ID: 198
- Difficulty: Easy
- URL: https://leetcode.com/problems/lc-house-robber/
- Tags: Blind 75, NeetCode 150
- Techniques: Dynamic Programming, Tabulation, Array
14.15.2 Description
Given a lc-list of non-negative integers representing the amount of money in each house along a street, determine the maximum amount you can rob without robbing two adjacent houses.
14.15.5 Solution - Linear DP
14.15.5.1 Walkthrough
Let dp[i] be the best we can do up to house i. For each house, we either rob it plus dp[i-2] or skip it and take dp[i-1]. Initialize the first two values and iterate.