50House Robber: the pick-or-skip 1D DP.▼mediumGoogleAmazonMeta2 replies◆ premiumHouse Robber is the cleanest choose-with-a-constraint 1D DP, and it collapses to O(1) space. The signal is the take-this-or-skip recurrence and the two-variable rolling optimization.Open full answer →
58Decode Ways: count the decodings of a digit string (1D DP).▼mediumGoogleMetaAmazon1 replies◆ premiumDecode Ways is a 1D DP whose difficulty lives entirely in the edge cases: zeros and the valid 1-26 range. The signal is the take-one-digit-or-two recurrence plus disciplined validity checks. Here is the answer.Open full answer →