There is a problem in a solution of DISTINCT NUMBERS problem

Hi.

In above problem the last test case is looking inappropriate to me. The last array is [1, 2, 5] and the length of it is 3 so X could be [3, 4, 6] as 1≤X≤2⋅N .
If I append 6, the array is [ 1, 2, 5, 6 ] and total = 0
If I append 4 the array is [1 ,2 ,5 ,6,4] and total is 6 - 4 = 2
If I append 3 the array is [1, 2, ,5 ,6, 4, 3] and total = 6- 3 = 3
so my max total is 2 + 3 = 5 which does not match with their calculation .
Please guide me.

You are also limited by the number of moves. You can only use K moves to get the maximum sum. For this test case, K is 2. But the solution you have described uses 3 moves.