Java Solution Sorting + Prefix Sum
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int maxScore(int[] nums) {
        if(nums.length == 1){
            return nums[0] > 0 ? 1 : 0;
        }
        Arrays.sort(nums);
        reverseArray(nums);
        long presum = 0;
        int count = 0;
        for(int num : nums){
            presum += num;
            if(presum > 0){
                count++;
            } else {
                break; 
            }
        }
        return count;
    }
    private void reverseArray(int[] array){
        int left = 0;
        int right = array.length - 1;
        while(left < right){
            int temp = array[left];
            array[left] = array[right];
            array[right] = temp;
            left++;
            right--;
        }
    }
}
```
['Java']