Skip to content

Commit 19a792e

Browse files
authored
Update 198.house-robber.md
调整变量名称与其他版本保持一直
1 parent c2732d3 commit 19a792e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

problems/198.house-robber.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ class Solution {
179179
if (length == 1) {
180180
return nums[0];
181181
}
182-
int first = nums[0], second = Math.max(nums[0], nums[1]);
182+
int prev = nums[0], cur = Math.max(nums[0], nums[1]);
183183
for (int i = 2; i < length; i++) {
184-
int temp = second;
185-
second = Math.max(first + nums[i], second);
186-
first = temp;
184+
int temp = cur;
185+
cur = Math.max(prev + nums[i], cur);
186+
prev = temp;
187187
}
188-
return second;
188+
return cur;
189189
}
190190
}
191191
```

0 commit comments

Comments
 (0)