Fastest and easiest java solution
If you like then upvote it and if you don\'t understand then comment it.\nTime complexity = O(nlogn) for sorting\nSpace complexity = O(1) because we didn\'t use
If you like then upvote it and if you don\'t understand then comment it.\nTime complexity = O(nlogn) for sorting\nSpace complexity = O(1) because we didn\'t use any extra space.\n\n```\n   \nclass Solution {\n   void swap(int[] nums, int i, int j)\n   {\n       int temp = nums[i];\n       nums[i]= nums[j];\n       nums[j]=temp;\n   }\n    public int maxScore(int[] nums) {\n        Arrays.sort(nums);\n        int n = nums.length;\n        int i=0,j=n-1;\n        //Reversing the sorted array\n        while(i<j)\n        {\n            swap(nums,i,j);\n            i++;\n            j--;\n        }\n       \n        int count=0;\n        // Making prefixSum long for managing overflow situation\n        long prefixSum = 0;\n        for(i=0;i<nums.length;i++)\n        {\n            prefixSum += nums[i];\n            if(prefixSum>0)\n                count++;\n\n        }\n        return count;\n        \n    }\n}\n```
['Java']