O(n) solution
Any linear combination of some subset of numbers is divisible by their greatest common divisor and GCD can be obtained as some linear combination. Thus, an arra
Any linear combination of some subset of numbers is divisible by their greatest common divisor and GCD can be obtained as some linear combination. Thus, an array is good if and only if GCD of its values is 1.\n\n\n```\n    bool isGoodArray(vector<int>& nums)\n    {\n        if (nums.empty()) return false;\n        int d = nums[0];\n        for (int i = 1; i < nums.size(); i++)\n            d = gcd(d, nums[i]);\n        return d == 1;\n    }\n```
[]