Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Count the frequency of each element in odd positions in the array. Do the same for elements in even positions.
To minimize the number of operations we need to maximize the number of elements we keep from the original array.
What are the possible combinations of elements we can choose from odd indices and even indices so that the number of unchanged elements is maximized?