Given an integer array nums of size n containing distinct integers, and an integer k, return the number of non-empty subarrays that have a median equal to k.
The median of an array is the middle element after sorting its elements in non-decreasing order. If the array contains an even number of elements, the median is defined as the left middle element (the element located at index
Note: A subarray is a contiguous, non-empty sequence of elements within an array.
Constraints:
n nums.length
n
nums[i], k n
All integers in nums are distinct.
Given an integer array nums of size n containing distinct integers, and an integer k, return the number of non-empty subarrays that have a median equal to k.
The median of an array is the middle element after sorting its elements in non-decreasing order. If the array contains an even number of elements, the median is defined as the left middle element (the element located at index
Note: A subarray is a contiguous, non-empty sequence of elements within an array.
Constraints:
n nums.length
n
nums[i], k n
All integers in nums are distinct.