Wednesday, December 14, 2005

Unrotating a Sorted Array

given a sorted array of length N, that is rotated by X spots. find X.

ie. original sorted array: 1-4-10-25-39-42-55-99
rotated by 3 gives: 25-39-42-55-99-1-4-10

this was given as a microsoft intern interview question

No comments: