Ezvor

1150. Check If a Number Is Majority Element in a Sorted Array

EasyArray Preparing judge… LeetCode
ArrayBinary Search

Hints

Hint 1
How to check if a given number target is a majority element?.
Hint 2
Find the frequency of target and compare it to the length of the array.
Hint 3
You can find the frequency of an element using Binary Search since the array is sorted.
Hint 4
Using Binary Search, find the first and last occurrences of A. Then just calculate the difference between the indexes of these occurrences.