198. House Robber
# Easy
Last updated
Was this helpful?
# Easy
Last updated
Was this helpful?
robs[x] means the max money can rob in house [0:x]
Initialize robs[0]
and robs[1]
. Initialize as much as possible.
Time complexity = , spcase complexity =
Only robs[x-2]
and robs[x-1]
are used for computing robs[x]
.
Initialization is important.
Time complexity = , space complexity =