Skip to content

Commit 3bcc3a6

Browse files
Update house-robber.md
1 parent 2998feb commit 3bcc3a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

java/house-robber.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ To optimize the recursive approach, we can use memoization to store the results
5252
```java
5353
class Solution {
5454
public int rob(int[] nums) {
55-
int[] memo = new int[nums.length + 1];
55+
int[] memo = new int[nums.length];
5656
Arrays.fill(memo, -1);
5757
return robFrom(0, nums, memo);
5858
}

0 commit comments

Comments
 (0)