Problem · Array
Count Elements with at Least One Smaller and One Greater Value
Learn this problemProblem statement
You are given an array of integers, count the number of elements having at least one smaller value and at least one greater value.
Input:
The input to the solution function consists of an integer array Nums.
Output:
Return the count.
Function
countElementsWithAtLeastOneSmallerAndOneGreaterValue(nums: int[]) → intExamples
Example 1
nums = [1, 2, 3]return = 1Only element 2 satisfies the condition.
Constraints
naMore Uber problems
- Last Truck to Leave the LaneOA · Seen Jul 2026
- Chain of CommandOA · Seen Jul 2026
- Jump Game with Prime-3 StepsOA · Seen Jun 2026
- Total Palindrome Substring CostOA · Seen Jun 2026
- Earliest Time All Users Are ConnectedPHONE SCREEN · Seen May 2026
- Tournament Rounds by RankPHONE SCREEN · Seen May 2026
- Farthest Seat AssignmentONSITE INTERVIEW · Seen May 2026
- Convex Function MinimizationPHONE SCREEN · Seen May 2026