clang-format and clang-tidy fixes for cdf701c2

This commit is contained in:
github-actions 2021-07-04 03:09:32 +00:00
parent cdf701c2a8
commit 50279f78bc

View File

@ -34,14 +34,15 @@ std::uint64_t houseRobber(const std::vector<int> &money, int n) {
if (n == 1) { // if there is only one house
return money[0];
}
if (n == 2) { // if there are two houses, one with the maximum amount of money will be robbed
return std::max(money[0],money[1]);
if (n == 2) { // if there are two houses, one with the maximum amount of
// money will be robbed
return std::max(money[0], money[1]);
}
int max_value = 0; // contains maximum stolen value at the end
int value1 = money[0];
int value2 = std::max(money[0],money[1]);
int value2 = std::max(money[0], money[1]);
for (int i = 2; i < n; i++) {
max_value = std::max(money[i]+value1,value2);
max_value = std::max(money[i] + value1, value2);
value1 = value2;
value2 = max_value;
}