Compare Counts Around a Pivot
Problem statement
Given integers numbers and pivot, count values strictly greater than the pivot and strictly less than it. Values equal to the pivot belong to neither count.
Return "greater", "smaller", or "tie" according to which count is larger.
Function
compareAroundPivot(numbers: int[], pivot: int) → StringExamples
Example 1
numbers = [1,5,7,5,2]pivot = 5return = "smaller"Two values are smaller, one is greater, and the two fives are ignored.
Example 2
numbers = [1,9]pivot = 5return = "tie"One value lies on each side of the pivot.
Constraints
0 <= numbers.length <= 100000