← 返回 amazon 的题目列表Pivot Compare
类型:online_judge
Given an integer array arr and an integer pivot, compute the count of numbers in arr that are strictly greater than pivot and the count of numbers that are strictly less than pivot. Compare these counts: if the count of greater numbers is larger, return "bigger"; if the count of lesser numbers is larger, return "smaller"; if they are equal, return "tie". Input size: the length of arr is between 1 and 10^5, and the values of elements are between -10^9 and 10^9.
Example
Input: [1, 3, 5, 7], pivot = 4
Output: "bigger"
Input: [1, 3, 5, 7], pivot = 5
Output: "smaller"
Input: [4, 4, 4], pivot = 4
Output: "tie"
Example
Input
1 3 5 7
4