Official algorithmic problem description and constraints.
You are given an array π of π integers.
The median of an array π, where π is the array πsorted in non-decreasing order. For example, the median of the array [9,5,1,2,6] is 5, as in the sorted array [1,2,5,6,9], the number at index β52β=3β52β=3 is 5, and the median of the array [9,2,8,3] is 3, as in the sorted array [2,3,8,9], the number at index β42β=2β42β=2 is 3
You are allowed to choose an integer π (1β€πβ€π) and increase ππ by 1 in one operation.
Your task is to find the minimum number of operations required to increase the median of the array.
Note that the array π may not necessarily contain distinct numbers.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.