We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05bc79e commit 9bcbf36Copy full SHA for 9bcbf36
house-robber/README.md
@@ -0,0 +1,33 @@
1
+## Rob or not
2
+
3
+assume that there are 9 houses along the street
4
+and you have a `rob` func can tell you the how much money you can get from first 8 hourses.
5
6
7
+what about the 9th house
8
9
+```
10
+? = not sure
11
+* = must rob
12
+_ = must not rob
13
14
+rob
15
16
+[? ? ? ? ? ? ? ?] _ *
17
+[0 1 2 3 4 5 6 7] 8 9
18
19
+money = rob(0..7) + house_value[9]
20
21
+or not
22
23
+[? ? ? ? ? ? ? ? ?] _
24
+[0 1 2 3 4 5 6 7 8] 9
25
26
+money = rob(0..8)
27
28
29
+rob(0..9) = max(rob(0..8), rob(0..7) + house_value[9])
30
31
32
+then it is easy to write a `rob(0..n)`
33
0 commit comments