Skip to main content
mediumBlind 75

House Robber

Given an array representing money in each house Return the maximum amount you can rob without robbing adjacent houses You cannot rob two adjacent houses (they have connected security) Example: [1,2,3,1] => 4 (rob house 0 and 2: 1+3) Example: [2,7,9,3,1] => 12 (rob house 0, 2, 4: 2+9+1)

House Robber is a dynamic programming question: define the state cleanly and the transitions usually follow. Interviewers love it because it reveals your state-and-transition thinking and your edge-case discipline. The trap is picking a state that's too vague; keep it minimal and consistent.

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit, and to talk with her for one hour. After that, talking comes with the $79 pack. Anyone can open the editor and run their code.

1Maximum Amount Without Adjacentmedium
Based onLeetCode

Get a note when something new lands

New company guides, new problems and big changes to Coco. Rare, and you can leave any time. By joining you agree to get these emails.