Simple O(N) solution - Java
Code
# Code
```java []
class Solution {
    public int maxScore(int[] nums) {
        if(nums == null || nums.length == 0) {
            return 0;
        }
        Arrays.sort(nums);
        long[] prefix = new long[nums.length];
        int max = 0;
        for(int index = nums.length - 1; index >= 0; index--) {
            prefix[index] = index == nums.length - 1 ? nums[index] : nums[index] + prefix[index + 1];
            if(prefix[index] > 0) {
                max++;
            }
        }
        return max;
    }
}
```
['Java']