2dbi

Solve a problem combining House Robber II and Combination Sum

via2dbi

Problem

A story-based DSA problem blending House Robber II (a circular constraint) and Combination Sum (choosing combinations that reach a target).

Approach

  • Model the choose/skip recurrence from House Robber II, handling the circular boundary by solving two linear cases
  • Layer in Combination Sum's target-reaching selection
  • Move from the plain recursive solution to a memoized (DP) one

Note

Clarify the exact blended rules with the interviewer before coding.

Add a follow-up question they asked
Memoize the blended recurrence
Handle the circular boundary
asked …
LeaderboardSalary
Language
Account