Concept Flow - Count Occurrences of Element in Sorted Array
Start
Input: sorted array, target element
Find first occurrence index using binary search
Find last occurrence index using binary search
Calculate count = last - first + 1
Return count
End
We use two binary searches to find the first and last positions of the target element, then calculate how many times it appears.