Skip to content

Commit ee2b7e2

Browse files
authored
Update house-robber.cpp
1 parent b0f1e6a commit ee2b7e2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/house-robber.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class Solution {
55
public:
66
int rob(vector<int>& nums) {
77
int last = 0, result = 0;
8-
for (const auto i : nums) {
8+
for (const auto& i : nums) {
99
auto tmp = result;
10-
result = max(last + i,result);
10+
result = max(last + i, result);
1111
last = tmp;
1212
}
1313
return result;

0 commit comments

Comments
 (0)