Check If It Is a Good Array LeetCode solution in C++

1
class Solution {
2
public:
3
bool isGoodArray(vector<int> &nums) {
4
int gcd = 0;
5
for (int i = 0; i < nums.size(); i++) {
6
gcd = __gcd(gcd, nums[i]);
7
}
8
return gcd == 1;
9
}
10
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0