✅C++ || Beginner Friendly && EASY CODE || CLEAN CODE
\n\nT->O(n logn) && S->O(1)\n\n\tclass Solution {\n\t\tpublic:\n\t\t\tint maxScore(vector& nums) {\n\t\t\t\tint n = nums.size();\n\t\t\t\tint ans = 0;\n\t\t\t\t
![image](https://assets.leetcode.com/users/images/c4cd943b-c116-401d-9f58-39727e476e9e_1678594063.466264.png)\n\n**T->O(n logn) && S->O(1)**\n\n\tclass Solution {\n\t\tpublic:\n\t\t\tint maxScore(vector<int>& nums) {\n\t\t\t\tint n = nums.size();\n\t\t\t\tint ans = 0;\n\t\t\t\tlong long sum = 0;\n\t\t\t\tsort(nums.begin(),nums.end(),greater<int>());\n\n\t\t\t\tfor(int i=0;i<n;i++){\n\t\t\t\t\tsum+=nums[i];\n\t\t\t\t\tif(sum > 0) ans++;\n\t\t\t\t}\n\n\t\t\t\treturn ans;\n\t\t\t}\n\t\t};
['Array', 'C', 'Sorting', 'Prefix Sum', 'C++']