Amazon interview question

House Robber from Leet Code