Cisco Interview Question

count number of occurrences in a sorted array