Company: CDK Global
Difficulty: medium
Ashley finds solution One day, Ashley was given a task to find the minimum element in a sorted rotated array that may contain duplicates. She was a bit nervous because she knew that the traditional approach of simply iterating through the array and finding the minimum element would not work in this case, since the array was rotated and may contain duplicates. She sat down and thought about the problem for a while and then an idea struck her. She remembered learning about an algorithm in her computer science class and realized that this could be a perfect solution for finding the minimum element in a sorted rotated array. Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become: [4,5,6,7,0,1,4] if it was rotated 4 times. [0,1,4,4,5,6,7] if it was rotated 7 times. Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]] . Give