C++ Solution
Approach\n Describe your approach to solving the problem. \n    Sorting\n\n# Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \n    O(n
# Approach\n<!-- Describe your approach to solving the problem. -->\n    Sorting\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(n * log(n))\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int maxScore(vector<int>& nums) {\n        sort(nums.rbegin(), nums.rend());\n        long long sum = 0;\n        int ans = 0;\n        for (int i = 0; i < nums.size(); i++) {\n            sum += nums[i];\n            if (sum > 0) ans++;\n        }\n        return ans;\n    }\n};\n```
['C++']