cpp sort and count || easy solution || no runtime error
\nclass Solution {\npublic:\n    int maxScore(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        reverse(nums.begin(),nums.end());\n        i
```\nclass Solution {\npublic:\n    int maxScore(vector<int>& nums) {\n        sort(nums.begin(),nums.end());\n        reverse(nums.begin(),nums.end());\n        int c=0;\n        long long int ans=0;     //use long long to avoid runtime error\n        for(int i=0;i<nums.size();i++)\n        {\n            ans+=nums[i];\n            if(ans>0)\n            {\n                c++;\n            }\n        }\n        return c;\n        \n    }\n};\n```
['C++']