You are given an integer array nums and a positive integer k.
In a single operation, you can increment or decrement any element of nums by
Return the minimum number of operations required to make the median of nums equal to k.
Note: The median of an array is defined as the middle element after sorting the array in nondecreasing order. If the array contains an even number of elements, the median is the element located at index
using indexing.
Constraints:
nums.length
nums[i]
k
You are given an integer array nums and a positive integer k.
In a single operation, you can increment or decrement any element of nums by
Return the minimum number of operations required to make the median of nums equal to k.
Note: The median of an array is defined as the middle element after sorting the array in nondecreasing order. If the array contains an even number of elements, the median is the element located at index
using indexing.
Constraints:
nums.length
nums[i]
k