Simple Java 5 lines solution
Intuition\n Describe your first thoughts on how to solve this problem. \n Sort the array in ascending order and start from the right. \n keep adding the numbers
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n* Sort the array in ascending order and start from the right. \n* keep adding the numbers from right and if the sum is positive, increase the count by 1. \n* As soon as sum reaches 0 or negative, break out of the loop and return the value of count; \n\n\n\n# Complexity\n- Time complexity: O(NlogN) - for sorting the array\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maxScore(int[] nums) {\n        Arrays.sort(nums);\n        long sum = 0;\n        int count = 0; \n        for(int i=nums.length-1; i>=0; i--){\n            sum += nums[i];\n            if(sum > 0) count++;\n            else break; \n        }\n        return count; \n    }\n}\n```
['Java']