Skip to content

Files

Latest commit

author
Mauricio Klein
Nov 30, 2019
d1fa529 · Nov 30, 2019

History

History
16 lines (11 loc) · 287 Bytes

README.md

File metadata and controls

16 lines (11 loc) · 287 Bytes

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