Bezout's Identity
Read (https://brilliant.org/wiki/bezouts-identity/, https://en.wikipedia.org/wiki/B\xE9zout%27s_identity)\n\nThe basic idea is that for integers a and b, if gcd
Read (https://brilliant.org/wiki/bezouts-identity/, https://en.wikipedia.org/wiki/B\xE9zout%27s_identity)\n\nThe basic idea is that for integers a and b, if gcd(a,b) = d, then there exist integers x and y, s.t  a * x + b * y = d;\n\nThis can be generalized for (n >= 2) .  e.g.  if gcd(a,b,c) = d, then there exist integers x, y, and z, s.t, a* x + b*y + c * z = d.\n\nNow this problem is just asking if gcd(x1, ......, xn) = 1\n\n```\nclass Solution {\n\npublic:\n    bool isGoodArray(vector<int>& nums) {\n        if (nums.size() == 1) return nums[0] == 1;\n        \n        int a = nums[0];\n        \n        for (int i = 1; i < nums.size(); i++) {\n            if (__gcd(a, nums[i]) == 1) return true;\n            a = __gcd(a, nums[i]);\n        }\n        \n        return false;\n    }\n};\n```
[]