Without zero intuition
Intuition\nMinimum AND will be the AND of whole array\nIncrease size of subarray will decrease AND value\n\n\n# Approach\nWe can try to make splits such that cu
# Intuition\nMinimum AND will be the AND of whole array\nIncrease size of subarray will decrease AND value\n\n\n# Approach\nWe can try to make splits such that currSplitAND + RestSplitAND = MinAND\nIf it is > MinAND, we can increase current split length\n\nIf (currSplitAND + RestSplitAND = MinAND) is satisfied, we should now find min splits in RestSplit with new MinAND as (MinAND - currSplitAND)\n\nRestSplitAND is suffix AND\n\nEg: MinAND = 7\n| 2 | 5 |\nWe found currSplit AND with 2 and restsplit AND as 5 which satisfies the minimum. Now we can solve subproblem to split restsplit with minAND 5\n\n# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int maxSubarrays(vector<int>& nums) {\n        int n = nums.size();\n\n        if(n == 1 && nums[0] == 0) return 1;\n\n        int minAND = nums[0];\n        for(int x: nums) minAND = minAND&x;\n\n        int suffAND[n+1];\n        suffAND[n] = 0;\n        suffAND[n-1] = nums[n-1];\n\n        for(int i=n-2; i>=0; i--) suffAND[i] = suffAND[i+1] & nums[i];\n\n        int res = 0;\n\n        function<void(int, int, int)>solve = [&](int i, int j, int need) {\n            if(i>j) return;\n            res++;\n            int curr = (1<<30)-1;\n            int a=i;\n            for(a;a<=j; a++) {\n                curr &= nums[a];\n                if(curr + suffAND[a+1] == need) break;\n            }\n            solve(a+1,j, need-curr);\n        };\n\n        solve(0, n-1, minAND);\n        return res;\n    }\n};\n```
['C++']