LC: 1150. Check If a Number Is Majority Element in a Sorted Array - spiralgo/algorithms GitHub Wiki
1150. Check If a Number Is Majority Element in a Sorted Array:
The Essence:
If a number is the majority element in an array, more than half of the array should be consist of this target element.
So, from the first index that we encountered the target element to the index that is greater by half-size of the array should have the target element.
int plusHalfSizeIndex = firstIndex + nums.length/2;
It means we should find the target element at plusHalfSizeIndex
Details:
We can use Binary Search for the first index that we encountered the target element.