Skip to content
Learn Netverks
Company prep Amadeus
Fresher (0–1 years) Coding / DSA Easy

Solve House Robber with constant space DP

Reported in Amadeus European engineering loops. Simple but important recurrence-based DP interview problem.

Location
Prague, Czech Republic

Context for Amadeus candidates:

Maximize money robbed from non-adjacent houses in a line.

Try answering aloud first

Cover trade-offs, structure, and a concrete example before revealing the baseline response.

Spoiler-free prep mode

How to frame this at Amadeus: Connect your answer to measurable impact, clarity of thought, and trade-offs the team cares about. Below is a strong baseline response you can adapt with your own project examples.

At each house, choose max of two options: rob current house plus best till i-2, or skip current and keep best till i-1. This naturally forms a linear DP recurrence.

Space can be reduced to two rolling variables instead of a full array. That keeps O(n) time and O(1) extra space while preserving correctness.

Comments (0)

Share how this question came up in your loop, or add tips for others preparing.

Log in to comment on this question.