File tree Expand file tree Collapse file tree 2 files changed +14
-29
lines changed
check-if-it-is-a-good-array Expand file tree Collapse file tree 2 files changed +14
-29
lines changed Original file line number Diff line number Diff line change @@ -7,33 +7,18 @@ using namespace std;
7
7
#include < algorithm>
8
8
#include < numeric>
9
9
10
-
11
10
#include " gcd.hpp"
12
- // template <class InputIt, class T, class BinaryOperation>
13
- // constexpr // since C++20
14
- // T
15
- // accumulate2(InputIt first, InputIt last, T init, BinaryOperation op)
16
- // {
17
- // for (; first != last; ++first)
18
- // init = op(std::move(init), *first); // std::move since C++11
19
-
20
- // return init;
21
- // };
22
- // int gcd(int num1, int num2)
23
- // {
24
- // while (num2 != 0) {
25
- // int temp = num1;
26
- // num1 = num2;
27
- // num2 = temp % num2;
28
- // }
29
- // return num1;
30
- // };
11
+ namespace check_if_it_is_a_good_array
12
+ {
31
13
32
- class Solution {
33
- public:
34
- bool isGoodArray (vector<int > &nums) {
35
- int divisor = accumulate<std::vector<int >::iterator, int , int (int , int )>(
36
- nums.begin (), nums.end (), nums[0 ], gcd);
37
- return divisor == 1 ;
38
- }
39
- };
14
+ class Solution
15
+ {
16
+ public:
17
+ bool isGoodArray (vector<int > &nums)
18
+ {
19
+ int divisor = accumulate<std::vector<int >::iterator, int , int (int , int )>(
20
+ nums.begin (), nums.end (), nums[0 ], gcd);
21
+ return divisor == 1 ;
22
+ }
23
+ };
24
+ }
Original file line number Diff line number Diff line change 5
5
#include < iostream>
6
6
7
7
using namespace std ;
8
-
8
+ using namespace check_if_it_is_a_good_array ;
9
9
TEST (check_if_it_is_a_good_array, test1)
10
10
{
11
11
cout << " check-if-it-is-a-good-array" << endl;
You can’t perform that action at this time.
0 commit comments