[Python] Count the number of negative numbers and zeros; Explained.
We can count the number of negative numbers and zeros in the list.\n\nIf the sum of all the positive numbers is larger than 0 (i.e., we have positive prefix sum
We can count the number of negative numbers and zeros in the list.\n\nIf the sum of all the positive numbers is larger than 0 (i.e., we have positive prefix sum), we can first append zeros to the arranged list starting with all the positive numbers. After that, we append the negative numbers from the smallest so that we can get the longest prefix sum list.\n\n```\nclass Solution:\n    def maxScore(self, nums: List[int]) -> int:\n        negative_nums = []\n        score, psum, zeros = 0, 0, 0\n        for num in nums:\n            if num > 0:\n                score += 1\n                psum += num\n            elif num == 0:\n                zeros += 1\n            else:\n                heapq.heappush(negative_nums, -num)\n        \n        if psum > 0:\n            score += zeros\n        \n        while negative_nums:\n            n = heapq.heappop(negative_nums)\n            psum = psum - n\n            if psum > 0:\n                score += 1\n            else:\n                break\n        return score\n```
['Heap (Priority Queue)', 'Python3']