Description
Given an integer array nums, return the number of elements that have both a strictly smaller and a strictly greater element in nums.
Examples
Input:
nums = [11,7,2,15]Output:
2Explanation:
7 and 11 satisfy the condition.
Input:
nums = [-3,3,3,90]Output:
2Explanation:
The minimum is -3 and the maximum is 90. The elements 3 and 3 each have both a strictly smaller element (-3) and a strictly greater element (90), so the count is 2.
Input:
nums = [5,5,5,5]Output:
0Explanation:
All elements are equal, so no element has both strictly smaller and strictly greater elements than itself.
Constraints
- •
1 ≤ nums.length ≤ 100