Optimal Rotated Array 🔥🔥
IntuitionI immediately thought of reversing the array, as that is the best possible way to maximize the score of it's prefix (logically).ApproachMy approach jus
# Intuition
I immediately thought of reversing the array, as that is the best possible way to maximize the score of it's prefix (logically).

# Approach
My approach just reverses the array, calculates it's prefix, and returns the count of the elements that are positive.

# Complexity
- Time complexity:
$$O(n)$$

- Space complexity:
$$O(n)$$

# Code
```python3 []
class Solution:
    def maxScore(self, nums: List[int]) -> int:
        nums.sort(reverse=True)
        prefix = [0]
        for i in range(1, len(nums) + 1):
            prefix.append(prefix[-1] + nums[i - 1])
        return len([i for i in prefix if i > 0])

```
['Python3']