Brainteaser | Bit Manipulation
Intuition\nIf Bitwise AND of complete array is greater than 0 then we can not reduce the score below that so we return 1 otherwise if the score is zero just bre
## Intuition\nIf Bitwise `AND` of complete array is greater than `0` then we can not reduce the score below that so we return `1` otherwise if the score is zero just break the array into maximum number of segments such that their `AND` == `0`\n\n## Approach\nIterate through the array, updating `c` and also tracking a secondary bitwise `AND` result `sc`. If `c` becomes 0 during the iteration, I increment the count `cnt` and reset `c` to INT_MAX. Finally, return 1 if `sc` is greater than 0; otherwise, return `cnt`.\n\n## Complexity\n- Time complexity: $$O(n)$$  \n- Space complexity: $$O(1)$$ \n\n## Code\n```cpp\nclass Solution {\npublic:\n    int maxSubarrays(vector<int>& nums) {\n        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);\n        int cnt = 0, c = INT_MAX, sc = INT_MAX;\n        for(auto &x : nums){\n            sc &= x, c &= x;\n            if(c == 0) cnt++, c = INT_MAX;\n        } \n        return sc > 0 ? 1 : cnt;\n    }\n};\n```
['Array', 'Greedy', 'Bit Manipulation', 'C++']