The classic linear DP. At each house you either skip it and keep the best so far, or take it and add the best from two back. The signal is collapsing the table to two rolling variables and then handling the circular follow-up cleanly.
House robber: max sum you can take from a row of houses without hitting two adjacent ones
The classic linear DP. At each house you either skip it and keep the best so far, or take it and add the best from two back. The signal is collapsing the table to two rolling variables and then handling the circular follow-up cleanly.
Updated Aug 2026 · Grounded in real Forward Deployed Engineer interview loops and written to a senior-engineer editorial bar.
Interviewers expect the O(1)-space version once you have the recurrence. The real differentiator is House Robber II: a circular street where the first and last house are now adjacent. Candidates who try to special-case the wrap-around with conditionals usually tie themselves in knots. The clean move is to run the linear solver twice on two slices and take the max.
No comments yet — be the first to share your approach.
