Skip to content

Latest commit

 

History

History

challenge-45

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Occurrences of a number in a sorted array

Description

Given a sorted array, write a function that returns the number of occurences of a number in this array.

Can you do it in logarithmic time (O(logn))?

Example

Input:  
  arr = [1,2,2,2,5,7,9]
  k = 2

Output: 3