Skip to content

Commit 50279f7

Browse files
github-actionsgithub-actions
authored andcommitted
clang-format and clang-tidy fixes for cdf701c
1 parent cdf701c commit 50279f7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

dynamic_programming/house_robber.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ std::uint64_t houseRobber(const std::vector<int> &money, int n) {
3434
if (n == 1) { // if there is only one house
3535
return money[0];
3636
}
37-
if (n == 2) { // if there are two houses, one with the maximum amount of money will be robbed
38-
return std::max(money[0],money[1]);
37+
if (n == 2) { // if there are two houses, one with the maximum amount of
38+
// money will be robbed
39+
return std::max(money[0], money[1]);
3940
}
4041
int max_value = 0; // contains maximum stolen value at the end
4142
int value1 = money[0];
42-
int value2 = std::max(money[0],money[1]);
43+
int value2 = std::max(money[0], money[1]);
4344
for (int i = 2; i < n; i++) {
44-
max_value = std::max(money[i]+value1,value2);
45+
max_value = std::max(money[i] + value1, value2);
4546
value1 = value2;
4647
value2 = max_value;
4748
}

0 commit comments

Comments
 (0)