Skip to content

Latest commit

 

History

History

329-rotatedNum

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

betweenNums

Interview question of the issue #329 of rendezvous with cassidoo.

The Question

There is a sorted integer array that has been rotated an unknown number of times. Given that rotated array, return how many times it has been rotated. It may contain duplicate numbers!

Example:

> rotatedNum([4, 0, 1, 2, 3])
> 1

> rotatedNum([7, 9, 20])
> 0

> rotatedNum([7, 7, 314, 1337, 7])
> 4

Installing & Running

Just pnpm i to install all dependencies and then pnpm t to run the tests!