Kotlin O(n) greedy
Intuition\nThe smallest possible subarray score is 0.\n\nFirst, check if it is possible to sum all of subarray to 0. If not, then return 1 which is the only pos
# Intuition\nThe smallest possible subarray score is 0.\n\nFirst, check if it is possible to sum all of subarray to 0. If not, then return 1 which is the only possible subarray (the whole input aray) that satisfies the conditions and it is not possible to find more subarrays.\n\nIf whole array score is 0, then we try greedily to find more subarrays with 0 score, count them and return the count.\n\nAs worst, the only possbile subarry with 0 score is the whole array.\n\n# Code\n```\nclass Solution {\n    fun maxSubarrays(nums: IntArray): Int {\n        var p = nums[0]\n        for (n in nums)\n            p = p and n\n        \n        if (p != 0)\n            return 1\n        \n        var cur = Integer.MAX_VALUE\n        var res = 0\n        for (n in nums) {\n            cur = cur and n\n\n            if (cur == 0) {\n                res++\n                cur = Integer.MAX_VALUE\n            }\n        }\n\n        return res\n    }\n}\n```
['Greedy', 'Kotlin']