Skip to content

Practice Count Elements With Strictly Smaller and Greater Elements

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2148
LeetCode Problem

Count Elements With Strictly Smaller and Greater Elements

Problem Statement

Given an integer array nums, return the number of elements that have both a strictly smaller and a strictly greater element appear in nums.

Source: Count Elements With Strictly Smaller and Greater Elements on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [11,7,2,15]
Output
2

# Example 2

Input
nums = [-3,3,3,90]
Output
2

Constraints

1 <= nums.length <= 100
-10^5 <= nums[i] <= 10^5

Related LeetCode Problems

Practice more problems similar to Count Elements With Strictly Smaller and Greater Elements .

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.