Python O(nlogn) Time, O(n) Space
Complexity\n- Time complexity: O(nlogn)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n
# Complexity\n- Time complexity: $$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python []\nclass Solution(object):\n    def maxScore(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: int\n        """\n        nums.sort(reverse=True)\n        if nums[0]<=0:\n            return 0\n        n=len(nums)\n        s=0\n        for i in range(n):\n            s+=nums[i]\n            if s<=0:\n                return i\n        return n\n        \n```
['Python']