Skip to content

Commit ba5cb30

Browse files
authored
Update sum-of-mutated-array-closest-to-target.cpp
1 parent b56c5c1 commit ba5cb30

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

C++/sum-of-mutated-array-closest-to-target.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ class Solution2 {
4242
class Solution3 {
4343
public:
4444
int findBestValue(vector<int>& arr, int target) {
45-
const auto& max_arr = *max_element(arr.cbegin(), arr.cend());
46-
int left = 1, right = max_arr;
45+
int left = 1, right = *max_element(arr.cbegin(), arr.cend());
4746
while (left <= right) {
4847
const auto& mid = left + (right - left) / 2;
4948
if (check(arr, mid, target)) {

0 commit comments

Comments
 (0)