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

Easy
Array
Binary Search

Description

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.

Statistics

Acceptance
59.9%
Submissions
102,433
Accepted
61,360