[C++|Java|Python3] Greedy
C++\n\nclass Solution {\npublic:\n    int maxSubarrays(vector<int>& nums) {\n        int ans = 0, prefix = -1; \n        for (auto& x : nums) {\n            pre
C++\n```\nclass Solution {\npublic:\n    int maxSubarrays(vector<int>& nums) {\n        int ans = 0, prefix = -1; \n        for (auto& x : nums) {\n            prefix &= x; \n            if (prefix == 0) {\n                ++ans; \n                prefix = -1; \n            }\n        }\n        return max(1, ans); \n    }\n};\n```\nJava\n```\nclass Solution {\n    public int maxSubarrays(int[] nums) {\n        int ans = 0, prefix = -1; \n        for (var x : nums) {\n            prefix &= x; \n            if (prefix == 0) {\n                ++ans; \n                prefix = -1; \n            }\n        }\n        return Math.max(1, ans); \n    }\n}\n```\nPython3\n```\nclass Solution:\n    def maxSubarrays(self, nums: List[int]) -> int:\n        ans = 0\n        prefix = -1\n        for x in nums: \n            prefix &= x \n            if prefix == 0: \n                ans += 1\n                prefix = -1\n        return max(1, ans)\n```
['C', 'Java', 'Python3']