Skip to content

Commit 353db5d

Browse files
committed
Runtime: 0 ms (Top 100.00%) | Memory: 41.8 MB (Top 31.47%)
1 parent ddf07f4 commit 353db5d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/algorithms/H/House Robber/House Robber.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 0 ms (Top 100.00%) | Memory: 41.8 MB (Top 31.47%)
12
class Solution {
23
public int rob(int[] nums) {
34
int[] t = new int[nums.length] ;
@@ -16,11 +17,11 @@ static int helper(int[] nums, int i,int[] t){
1617
if(t[i] != -1){
1718
return t[i];
1819
}
19-
20+
2021
int pick = nums[i] + helper(nums,i+2,t);
2122
int unpicked = helper(nums,i+1,t);
2223
t[i] = Math.max(pick,unpicked);
2324
return t[i];
24-
25+
2526
}
26-
}
27+
}

0 commit comments

Comments
 (0)