50House Robber: the pick-or-skip 1D DP.▼mediumGoogleAmazonMeta2 replies◆ premiumHouse Robber is the tidiest choose-with-a-constraint 1D DP, and it reduces to O(1) space. Interviewers look for 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 sits entirely in the edge cases: zeros and the valid 1-26 range. Interviewers look for the take-one-digit-or-two recurrence plus disciplined validity checks. The answer follows.Open full answer →