Amazon Interview Question

House Robber II from leetcode.