C++ solution bitwise AND
Complexity\n- Time complexity:\nO(n)\n\n# Code\n\nclass Solution {\npublic:\n    int maxSubarrays(vector<int>& nums) {\n        int val = nums[0];\n        for(
# Complexity\n- Time complexity:\n$$O(n)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int maxSubarrays(vector<int>& nums) {\n        int val = nums[0];\n        for(int i=1;i<nums.size();i++){\n            val = val & nums[i];\n        }\n\n        if(val!=0)\n            return 1;\n        \n        int res = 0, ptr=0;\n        while(ptr < nums.size()){\n            int val = nums[ptr];\n            ++ptr;\n            while(val != 0 && ptr < nums.size()){\n                val&=nums[ptr];\n                ++ptr;\n            }\n            if(val == 0)\n                ++res;\n        }\n\n        return res;\n    }\n};\n```
['C++']