Skip to content

Commit 3fbb648

Browse files
authored
Update construct-target-array-with-multiple-sums.cpp
1 parent 14073c6 commit 3fbb648

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/construct-target-array-with-multiple-sums.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class Solution {
88
// (2) y + remain = total
99
// (1) - (2) => x - y = y - total
1010
// => x = 2*y - total
11-
auto total = accumulate(begin(target), end(target), 0ll);
12-
priority_queue<int> max_heap(target.cbegin(), target.cend());
11+
auto total = accumulate(cbegin(target), cend(target), 0ll);
12+
priority_queue<int> max_heap(cbegin(target), cend(target));
1313
while (total != target.size()) {
1414
const auto y = max_heap.top(); max_heap.pop();
1515
const auto& remain = total - y;

0 commit comments

Comments
 (0)