Skip to content

Commit 0a28775

Browse files
committed
Update index.hpp
1 parent 925183b commit 0a28775

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

check-if-it-is-a-good-array/index.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
#include <vector>
55

66
using namespace std;
7-
template <class InputIt, class T, class BinaryOperation>
8-
constexpr // since C++20
9-
T
10-
accumulate2(InputIt first, InputIt last, T init, BinaryOperation op)
11-
{
12-
for (; first != last; ++first)
13-
init = op(std::move(init), *first); // std::move since C++11
7+
//template <class InputIt, class T, class BinaryOperation>
8+
//constexpr // since C++20
9+
// T
10+
// accumulate2(InputIt first, InputIt last, T init, BinaryOperation op)
11+
//{
12+
// for (; first != last; ++first)
13+
// init = op(std::move(init), *first); // std::move since C++11
1414

15-
return init;
16-
};
15+
// return init;
16+
//};
1717
int gcd2(int num1, int num2)
1818
{
1919
while (num2 != 0) {
@@ -28,7 +28,7 @@ class Solution {
2828
public:
2929
bool isGoodArray(vector<int>& nums)
3030
{
31-
int divisor = accumulate2(nums.begin(), nums.end(), nums[0], gcd2);
31+
int divisor = accumulate(nums.begin(), nums.end(), nums[0], gcd2);
3232
return divisor == 1;
3333
}
3434
};

0 commit comments

Comments
 (0)