Databricks interview question

House Robber II from LC