c++, beats 100%, easy explaination, commmented code
Intuition\nMin score is the and of all the array elements.\nBecause suppose we have 1 at ith bit even if any one elemnt in the array has 0 at that bit the ith b
# Intuition\nMin score is the and of all the array elements.\nBecause suppose we have 1 at ith bit even if any one elemnt in the array has 0 at that bit the ith bit will now become permanently zero.\n\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nif min score if non zero return 1 else find sub arrays greedily which have a and value of zero.\n\nBecause we want the sum of scores of subarrays to be minimum. suppose we have a array ans we gotmin score as say 10 and there are max of 3 splits possible but now the sum of score will be 30 and our score of the original array is itself 10.\n\nso if we have min score positive splitting the array will not minimize the sum of scores of subbarrays, it will rather increase it. therefore it is better to return the original array\n\n<!-- Describe your approach to solving the 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# Code\n```\nclass Solution {\npublic:\n    int maxSubarrays(vector<int>& nums) {\n        \n        int n = nums.size();\n        int min_score = INT_MAX;\n\n  // finding the smallest and possible which is and of the whole array.\n\n// because suppose we have 1 at ith bit even if any one elemnt in the array has 0 at that bit the ith bit will now become permanently zero.\n\n        for(int i = 0; i < n; i++){\n\n            min_score &= nums[i];\n        }\n\n        // why?\n        if(min_score != 0){\n            return 1;\n        }\n\n        // because we want the sum of scores of subarrays to be minimum. suppose we have a array ans we gotmin score as say 10 and there are max of 3 splits possible but now the sum of score will be 30 and our score of the original array is itself 10.\n\n        // so if we have min score positive splitting the array will not minimize the sum of scores of subbarrays, it will rather increase it. therefore it is better to return the original array\n\n        int temp = INT_MAX;\n        int ans = 0;\n\n        for(int i = 0; i < n; i++){\n\n            temp &= nums[i];\n\n            if(temp == 0){\n                ans++;\n                temp = INT_MAX;\n            }\n        }\n\n        return ans;\n    }\n};\n```
['Bit Manipulation', 'C++']