Vijay Pagare

DSA - 1 new - House Robber (DP)


🧠 Problem: 198. House Robber

💡 Insight

Either:

Take the maximum of both choices.

Recurrence: dp[i] = max(nums[i] + dp[i+2], dp[i+1])


🧩 Comment

Had to think harder than expected. Derived using recursion + memoization, but initially missed the skip case edge condition, so the formulation wasn’t clean at first.


⚡ Key Learning

Whenever:

  1. You are making a choice at each step
  2. Choices are mutually exclusive (take vs skip)
  3. You want to maximize/minimize something

→ Think DP on decisions (take / skip pattern)


🧘 Note

Lower volume day due to family commitments — still showed up. Consistency matters more than intensity.

#Dsa #Leetcode