Check If It Is a Good Array
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public boolean isGoodArray(int[] nums) {\n        int gcd = nums[0]; // Start with the first element\n        for (int i = 1; i < nums.length; i++) {\n            gcd = gcd(gcd, nums[i]); // Compute GCD of the current GCD and the next element\n            if (gcd == 1) {\n                return true; // If at any point GCD becomes 1, return true\n            }\n        }\n        return gcd == 1; // Final check, return true if GCD is 1\n    }\n\n    // Helper function to compute GCD of two numbers using Euclidean algorithm\n    private int gcd(int a, int b) {\n        while (b != 0) {\n            int temp = b;\n            b = a % b;\n            a = temp;\n        }\n        return a;\n    }\n\n    public static void main(String[] args) {\n        Solution solution = new Solution();\n        System.out.println(solution.isGoodArray(new int[]{12, 5, 7, 23})); // Output: true\n        System.out.println(solution.isGoodArray(new int[]{29, 6, 10}));    // Output: true\n        System.out.println(solution.isGoodArray(new int[]{3, 6, 9}));      // Output: false\n    }\n}\n\n```
['Java']