C++ solution Sorting
Please, upvote if you like it. Thanks  :-)Complexity

Time complexity:
O(n log(n))


Space complexity:
O(1)

Code
Please, upvote if you like it. Thanks  :-)

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

- Space complexity:
O(1)

# Code
```cpp []
int maxScore(vector<int>& nums) {
    long res = 0, n = nums.size(), sum = 0;
    sort(begin(nums), end(nums), [](int a, int b) { return a > b; } );
    for (int i = 0; i < n; i++, res++) {
        if ((sum += nums[i]) <= 0)
            break;
    }
    return res;
}
```
['Array', 'Greedy', 'Sorting', 'Prefix Sum', 'C++']