Demandbase interview question

House Robber Leetcode problem , one DFS graph question