Very Simple || C++ || Math
Intuition\n Describe your first thoughts on how to solve this problem. \nIf we can find some numbers whose gcd is 1, then we can multiply each with some multipl
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nIf we can find some numbers whose gcd is 1, then we can multiply each with some multiplicand and add or subtract from each others, to get 1\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nIterate over the whole array and calculate gcd\nIf gcd is 1 then return true, otherwise false\n\n# Complexity\n- Time complexity: $$O(n*log(n))$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    bool isGoodArray(vector<int>& nums) {\n        int g = 0;\n        for(auto it: nums){\n            g = gcd(g, it);\n        }\n\n        return g==1;\n    }\n};\n```
['Array', 'Math', 'Number Theory', 'C++']