✅ Swift: Easy to Understand and Simple Solution
\n\n# Code\n\nclass Solution {\n    func maxScore(_ nums: [Int]) -> Int {\n        let sorted = nums.sorted(by: >)\n        var ans = 0\n        var sum = 0\n  
\n\n# Code\n```\nclass Solution {\n    func maxScore(_ nums: [Int]) -> Int {\n        let sorted = nums.sorted(by: >)\n        var ans = 0\n        var sum = 0\n        \n        for i in 0..<sorted.count{\n            sum += sorted[i]\n            if sum > 0{\n                ans += 1\n            }\n        }\n        \n        return ans\n    }\n}\n\n```
['Swift']