rearrange array to maximize prefix score
IntuitionApproachComplexity
Time complexity:

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

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

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

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

# Code
```java []
class Solution {
    public int maxScore(int[] nums) {
         int n=nums.length;
        Arrays.sort(nums);
        int count=0;
        long prefixSum=0;
        for(int i=n-1;i>=0;i--){
            prefixSum=prefixSum + nums[i];
            if(prefixSum>0) count++;
            else{
                break;
            }

        }
        return count++;
}
}
```
['Java']