here is my code: i am using the state switching solution.
for current house: there are 2 states, rob and not rob.
so the rob --> not rob (obviously because you can not rob next house)
not rob--> rob (rob the current one, then the state changed)
not rob --> not rob(do nothing)
rob = not_rob = 0
for n in nums:
rob,not_rob = not_rob +n,max(not_rob,rob)