MEDIUMasked at 37 companies

House Robber

A medium-tier problem at 52% community acceptance, tagged with Array, Dynamic Programming. Reported in interviews at Cleartrip and 36 others.

Founder's read

House Robber is a classic medium-difficulty dynamic programming problem that shows up constantly in assessments at Amazon, Airbnb, Cisco, Databricks, and dozens of other companies. You're given an array of house values and can't rob adjacent houses. Find the max loot. The trick isn't obvious on first read, and the greedy approaches fail. With a 52% acceptance rate, plenty of candidates stumble on the recurrence relation or blow through extra space they don't need. If you hit this live and blank on the DP pattern, StealthCoder solves it invisibly in seconds and surfaces a clean, optimized solution.

Companies asking
37
Difficulty
MEDIUM
Acceptance
52%

Companies that ask "House Robber"

If this hits your live OA

House Robber is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.

Get StealthCoder
What this means

The problem forces you to recognize that each house decision depends on optimal prior choices, not just local value. Many candidates try greedy (take the biggest house nearby) and fail immediately. Others build a full DP table but don't realize you can compress it to O(1) space by tracking only the last two states. The core insight: rob house i or skip it. If you rob it, add its value to the best result from house i-2. If you skip it, take the best from house i-1. This recurrence is the hard part to spot cold. Once you see it, the code is five lines. StealthCoder bridges that gap on the live OA when the pattern isn't clicking.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

House Robber recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built by an engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.

House Robber interview FAQ

Is House Robber actually asked at big tech companies?+

Yes. It's confirmed at Amazon, Airbnb, Cisco, Databricks, Agoda, and 32 other companies in the reports. It's one of the canonical DP warm-ups. With 37 companies asking it, you'll likely see it or a variant in your interview loop.

What's the trick most people miss?+

They don't realize it's DP. Greedy fails. The actual trick is recognizing that the choice at house i depends on optimal solutions at i-1 and i-2, not on absolute house values. Once you see that dependency, the recurrence is straightforward.

Can you solve it without a DP table?+

Yes. You only need two variables to track the max loot from the last two positions. As you iterate through the array, update them. This is O(n) time and O(1) space, which impresses interviewers. Many candidates build a full table unnecessarily.

How does this relate to other DP problems I should know?+

It's a foundational DP pattern called 'choose or skip'. You'll see variants in climbing stairs, decode ways, and other medium DP problems. Master the recurrence here and you'll recognize the pattern faster in related problems.

What if I blank on the solution during the assessment?+

That's exactly when StealthCoder works. It reads the problem on your screen, runs invisibly during screen share, and gives you the working solution in seconds. You paste it, walk through the logic, and move on. It's your safety net for the one problem you didn't drill.

Want the actual problem statement? View "House Robber" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.