PREFIX SUM OF SORTED ARRAY || C++ || EASY TO UNDERSTAND
\nclass Solution {\npublic:\n    bool static cmp(int &a,int &b){\n        return a>b;\n    }\n    int maxScore(vector<int>& nums) {\n        sort(nums.begin(),n
```\nclass Solution {\npublic:\n    bool static cmp(int &a,int &b){\n        return a>b;\n    }\n    int maxScore(vector<int>& nums) {\n        sort(nums.begin(),nums.end(),cmp);\n        if(nums[0]<=0)return 0;\n        long long int ans = 0;\n        int i = 0,n=nums.size();\n        for(i = 0; i < n; i++){\n            ans += nums[i];\n            if(ans<=0)break;\n        }\n        return min(i,n);\n    }\n};\n```
['Array', 'Greedy', 'C', 'Sorting', 'Prefix Sum', 'C++']