2 line code 0ms 100% beat 
Approach
`Let's walk through a dry run of the provided code with the input nums = [12, 5, 7, 23].Initialization:cpp
auto gcd = nums[0]; // gcd = 12
First iterat
Approach
`Let's walk through a dry run of the provided code with the input nums = [12, 5, 7, 23].

Initialization:

cpp
auto gcd = nums[0]; // gcd = 12
First iteration:

n = 12

Update gcd:

cpp
gcd = __gcd(12, 12); // gcd = 12
Second iteration:

n = 5

Update gcd:

cpp
gcd = __gcd(12, 5); // gcd = 1
Third iteration:

n = 7

Update gcd:

cpp
gcd = __gcd(1, 7); // gcd = 1
Fourth iteration:

n = 23

Update gcd:

cpp
gcd = __gcd(1, 23); // gcd = 1
After iterating through all the elements in the nums array, the final value of gcd is 1.

Return value:

cpp
return gcd == 1; // return true
So, the function will return true for the input nums = [12, 5, 7, 23]

Complexity
Time complexity: O(N)
Space complexity:O(N)`
Code
```
class Solution {
    public:
    bool isGoodArray(vector<int>& nums) {
    auto gcd = nums[0];
    for (auto n : nums) gcd = __gcd(gcd, n);
    return gcd == 1;
  }
};```

['Array', 'Math', 'Iterator', 'Number Theory', 'C++']