Solve a problem combining House Robber II and Combination Sum

Problem A story-based coding problem that blends two classics: the circular constraint of House Robber II (houses in a circle; the first and last are adjacent, and you cannot take two adjacent houses) with the target-reaching selection of Combination Sum (choose items so a chosen subset reaches a target). Clarify the exact blended rules with the interviewer before coding — how the circular adjacency and the target condition interact is the crux.

Input / Output

  • Input: depends on the agreed framing — typically a circular array of values plus a target.
  • Output: the optimal value / count / selection satisfying both constraints.

Requirements

  • Respect the circular no-two-adjacent rule from House Robber II.
  • Layer in Combination Sum's target-reaching selection.

Areas to work through

  • The choose/skip recurrence and how the circular boundary splits into two linear cases.
  • How target-reaching selection composes with the adjacency constraint.
  • Moving from plain recursion to a memoized (DP) solution.
asked …
LeaderboardSalaryAccount