Medium · Dynamic programming

House Robber

You are given the money in each house along a street. You cannot take from two houses that are next to each other. Return the most money you can take.

  • Amounts are whole numbers, zero or more.
  • There is at least one house.
  • Skipping more than one house in a row is allowed.
nums = [2, 7, 9, 3, 1]

→ 12   (2 + 9 + 1)
Record your take

No one has solved it yet.