Sort then Prefix
Complexity\nTime O(N * log N)\nSpace O(N) #for sorting\n\n# Code\n\nclass Solution(object):\n    def maxScore(self, nums):\n        nums.sort()\n        res = p
# Complexity\nTime `O(N * log N)`\nSpace `O(N) #for sorting`\n\n# Code\n```\nclass Solution(object):\n    def maxScore(self, nums):\n        nums.sort()\n        res = prefix = 0\n        while nums:\n            prefix += nums.pop()\n            if prefix > 0: \n                res += 1\n        return res\n```\n**UpVote**, if you like it :)
['Sorting']