Company: Turing_21april
Difficulty: medium
Maximize Achievements Score Problem Description Given an integer array called achievements , which represents the values of different achievements. Initially, the total score x is 0, and all achievements are marked as unclaimed. There is an operation that can be performed any number of times: Select an unclaimed achievement i from the range [0, n - 1] . If the score of the achievement at index i , achievements[i] , is higher than the current total score x , then add achievements[i] to x (i.e., x = x + achievements[i] ), and mark the achievement i as claimed. Find the maximum total score that can be obtained by performing the operations optimally. Examples Example 1: Input: achievements = [2,2,4,4] Output: 6 Explanation: During the operations, we can choose to claim the achievements at indices 0 and 2 in order, resulting in a total score of 6, which is the maximum. Example 2: Input: achievements = [1,5,3,2,1] Output: 9 Explanation: Claim the achievements at indices 0, 2, and 1 in order.