Databricks Interview Question

House Robber II from LC