Go, C# || Sort Descending
Approach\n - Sort nums is descending.\n - Sum prefix\n - If prefix > 0, increase res, else return.\n\n# Complexity\n- Time complexity: O(nlog(n))\n- Space compl
# Approach\n - Sort **nums** is descending.\n - Sum **prefix**\n - If **prefix** > 0, increase **res**, else return.\n\n# Complexity\n- Time complexity: O(nlog(n))\n- Space complexity: O(1)\n\n```Go []\nfunc maxScore(nums []int) int {\n\tvar res int = 0\n\tvar prefix int64 = 0\n\tsort.SliceStable(nums, func(i, j int) bool {\n\t\treturn nums[i] > nums[j]\n\t})\n\tfor _, num := range nums {\n\t\tprefix += int64(num)\n\t\tif prefix > 0 {\n\t\t\tres++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn res\n}\n```\n```C# []\npublic class Solution {\n    public int MaxScore(int[] nums)\n    {\n        int res = 0;\n        long predix = 0;\n        Array.Sort(nums, (a, b) => b - a);\n        foreach (int num in nums)\n        {\n            predix += num;\n            if (predix > 0)\n                res++;\n            else\n                return res; ;\n        }\n        return res;\n    }\n}\n```
['Go', 'C#']