AlgoFrames

Fill the house robber table

Warm-up · Trace the algorithm · about 5 min

Follow the house robber table for the houses 1, 2, 3, 1. Answer each question before the step plays.

Example 1

Input:

{"values":[1,2,3,1]}

Output:

4

Constraints

  • The trace uses the houses shown.
  • Two neighbours cannot both be robbed.

Learn the idea first: 1-D DP: house robber, decode ways, jump game II, a visual lesson.

More 1-D DP: house robber, decode ways, jump game II problems