Rearrange Array
Intuition\nMaximum score will be achieved when nums is in descending order.\n\n# Approach\n1. Sort nums in descending order\n2. Create prefix sum array\n3. Coun
# Intuition\nMaximum score will be achieved when nums is in descending order.\n\n# Approach\n1. Sort nums in descending order\n2. Create prefix sum array\n3. Count positive values \n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(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        num_pos = 0\n\n        # Best order of the array is in decreasing order\n        nums.sort(reverse = True)\n\n        # Create prefix sum array\n        prefix = [0] * len(nums)\n        prefix[0] = nums[0]\n        if prefix[0] > 0:\n            num_pos += 1\n\n        for i in range(1, len(nums)):\n            prefix[i] = prefix[i - 1] + nums[i]\n            if prefix[i] > 0:\n                num_pos += 1\n\n        return num_pos\n```
['Python']