Java
\n// O(n)\n// O(1)\nclass Solution {\n    public boolean isGoodArray(int[] nums) {\n        int n = nums.length;\n        if (n == 0 || nums == null) {\n       
```\n// O(n)\n// O(1)\nclass Solution {\n    public boolean isGoodArray(int[] nums) {\n        int n = nums.length;\n        if (n == 0 || nums == null) {\n            return false;\n        }\n        \n        int k = nums[0];\n        for (int i = 0; i < nums.length; i++) {\n            k = GCD(k, nums[i]);\n            if (k == 1) {\n                return true;\n            }\n        }\n        return false;\n    }\n    \n    public int GCD(int m, int n) {\n        if (m < n) {\n            return GCD(n, m);\n        }\n        \n        while (n != 0) {\n            int k = m % n;\n            m = n;\n            n = k;        \n        }\n        return m;\n    }\n}\n```
['Java']