Beats 100% T.C. JAVA users || O(N) Sol. || Bits Manipulation
Approach is based on the hints provided\n Describe your first thoughts on how to solve this problem. \n\n# Complexity\n- Time complexity: O(N)\n Add your time c
# Approach is based on the hints provided\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Explantion is in the code itself \nI have also discussed an edge case and made everything clear as much I could. Thanks for even viewing.\n\n# Code\n```\n\nclass Solution {\n    public int maxSubarrays(int[] nums) {\n        //And of all elements will be min as we increase the chances of getting more zeroes by anding more numbers\n        //so if And of all elements is not zero then answer will be no splitting i.e. 1\n        int AND=-1;\n        for(int i:nums){\n            AND = ( AND & i );\n        }\n        if(AND!=0) return 1;\n        // if And of the array is 0 then we will iterate over the array by keeping a temp set -1\n        // if temp gets 0 we will ans+=1;\n        // but for the last elements which are non-zero in the array , thus making the temp !=0\n        // that case is already taken care of by the previous occuring temp that was 0\n        // i am talking about cases like : {0,8,0,0,0,23}; here req output:4\n        // we will have our answer till 4th index as 4 but for the 5th index: 23 it is already taken care by the previous 0 and is the only case where we have our minds on.(just tryin to be cool...)\n\n        int ans=0;\n        int temp=-1;\n        for(int i=0;i<nums.length;i++){\n            temp &= nums[i];\n            if(temp==0){\n                ans++;\n                temp=-1;\n            }\n        }\n        return ans;\n    }\n}\n```\n![down.jpg](https://assets.leetcode.com/users/images/be7be045-62d9-4f03-8f2b-917e444e0432_1704374302.7327683.jpeg)
['Java']