Uber Interview Question

Count Frequency of an element in a sorted array in most optimised way