Count Elements With Strictly Smaller and Greater Elements
Given an integer array nums, return the number of elements that have both a strictly smaller and a strictly greater element appear in nums.
Example 1
Input
nums = [11,7,2,15]Output
2The elements 7 and 11 each have both a strictly smaller and a strictly greater element in
nums, so the total is 2.Example 2
Input
nums = [-3,3,3,90]Output
2Each of the two elements with value 3 has -3 strictly smaller and 90 strictly greater, so the total is 2.
Constraints
- 1 <= nums.length <= 100
- -10^5 <= nums[i] <= 10^5