Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
House Robber III
Bookmark
Input
Example 1
Example 2
Skewed Tree
Custom
tree
=
[3, 2, 3, null, 3, null, 1]
3
2
3
3
1
each pill = [skip, rob]
max
$?
each house returns
[skip, rob]
3
2
3
3
1
each pill = [skip, rob]
max
$?
each house returns
[skip, rob]
0,0
3
2
3
3
1
each pill = [skip, rob]
max
$?
null child returns
[0, 0]
3
2
3
3
1
each pill = [skip, rob]
max
$?
left →
[0, 0]
3
2
3
3
1
[
0
,
3
]
each pill = [skip, rob]
max
$?
house
3
→
[0, 3]
3
2
3
3
1
[
3
,
2
]
[
0
,
3
]
each pill = [skip, rob]
max
$?
house
2
→
[3, 2]
3
2
3
3
1
[
3
,
2
]
[
0
,
3
]
each pill = [skip, rob]
max
$?
left →
[0, 0]
0,0
3
2
3
3
1
[
3
,
2
]
[
0
,
3
]
each pill = [skip, rob]
max
$?
null child returns
[0, 0]
3
2
3
3
1
[
3
,
2
]
[
0
,
3
]
[
0
,
1
]
each pill = [skip, rob]
max
$?
right →
[0, 1]
3
2
3
3
1
[
3
,
2
]
[
1
,
3
]
[
0
,
3
]
[
0
,
1
]
each pill = [skip, rob]
max
$?
right →
[1, 3]
3
2
3
3
1
[
6
,
7
]
[
3
,
2
]
[
1
,
3
]
[
0
,
3
]
[
0
,
1
]
each pill = [skip, rob]
max
$7
max($6, $7) = $7
algo
master
.
io
Step:
Start House Robber III algorithm
0 / 38
Input
Example 1
Example 2
Skewed Tree
Custom
tree
=
[3, 2, 3, null, 3, null, 1]
0 / 38
algo
master
.
io
Step:
Start House Robber III algorithm