c++ solution | sorting | prefix | java
Code\n\nclass Solution {\npublic:\n   static bool cmp(int a,int b){\n        return a>b;\n    }\n    int maxScore(vector<int>& nums) {\n        sort(nums.begin(
# Code\n```\nclass Solution {\npublic:\n   static bool cmp(int a,int b){\n        return a>b;\n    }\n    int maxScore(vector<int>& nums) {\n        sort(nums.begin(),nums.end(),cmp);\n        \n        if(nums[nums.size()-1]>0)return nums.size();\n        \n        int ans=0;\n        long long int prefix=0;\n        for(auto i:nums){\n            prefix+=i;\n            if(prefix>0)ans++;\n            }        \n        \n    return ans;\n    }\n};\n```
['Greedy', 'Prefix Sum', 'C++', 'Java']