




Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
How to check if a given number target is a majority element?.
Find the frequency of target and compare it to the length of the array.
You can find the frequency of an element using Binary Search since the array is sorted.
Using Binary Search, find the first and last occurrences of A. Then just calculate the difference between the indexes of these occurrences.