🔥✅Best Solution in C++ || Sorting🔥 || O(1)SC✅✅
\n\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n### Please Upvote if u liked my Solution\uD83E\uDD17\n\nclass Solution {\
\n\n# Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n### Please Upvote if u liked my Solution\uD83E\uDD17\n```\nclass Solution {\npublic:\n    int maxScore(vector<int>& nums) {\n        sort(nums.begin(),nums.end(),greater<int>());\n        long ps=0,count=0;\n        for(int i=0;i<nums.size();i++){\n            ps+=nums[i];\n            if(ps>0)\n                count++;\n        }\n        return count;\n    }\n};\n```
['Greedy', 'Sorting', 'C++']