beats 100% in Java
Intuition\nSince we have to use and operator so chances of minimising the sum becomes higher as more elements are included because any new element/number may br
# Intuition\nSince we have to use and operator so chances of minimising the sum becomes higher as more elements are included because any new element/number may bring some bit as zero which would eventally makes the bit at that position zero for overall & operator. \n\n# Approach\nWe first try to find the minimum possible value of sum possible and then try to maximise the number of subarrays. To find the minimum value of sum, we would & all the elements of array. If it is greater that 0 then we have no choice but to include all elements so the subarray would be the array itself and the answer would be 1\n\nThe second case arised when the minimum possible value is zero, then it is possible that more that 1 subarray exist with zero value so we would count the number of subarrays where the elements give the value as zero when we and(&) them and that would be answer.\n\n# Complexity\n- Time complexity:\nIterating through the array twice so 2n or o(n).\n\n- Space complexity:\n0(1) as extra space only occupied by variable and independent of number of elements in the array.\n\n# Code\n```\nclass Solution {\n    public int maxSubarrays(int[] nums) {\n        int min_possible_sum = nums[0];\n        for(int i = 1; i<nums.length; i++){\n           min_possible_sum = min_possible_sum & nums[i];\n        }\n        if(min_possible_sum > 0){\n           return 1;\n        }\n\n        // if minimum possible sum is greater than zero then we have only one choice to include all elements so the answer is 1\n\n        int t = nums[0];\n        int ans = 0;\n        for(int i = 1; i<nums.length; i++){\n           if(t == 0){\n               ans++;\n               t = nums[i];\n               continue;\n           }\n           t &= nums[i];\n       }\n\n       if(t == 0){\n           ans++;\n       }\n\n       return ans;\n        \n    }\n}\n```
['Bit Manipulation', 'Java']