# Why such a test case exists ? The input array is [1,3,3]

• As the title said,it's an array which has been rotated beforehead.So I dont understand.
[1,3,3] is a sort array, isnt it?

• You can assume that this array is rotated at pivot 0 (0-based). So it's OK~

• I think if the array rotate in the pivot 0, it is the same array as before.
So the test case(un rotated array) should be included.
There is one possible solution here. I can not solve the problem when I try to compare the mid with the left.
I can only do it compare the mid with the right to avoid the un rotated array!

``````  int findMin(vector<int>& nums) {
int left = 0;
if (nums.size() == 1) return nums[0];
int right = nums.size() - 1;
while (left < right) {
int mid = left + (right - left) / 2;
if (nums[mid] > nums[right]) left = mid + 1;
else right = mid;
}
return nums[left];
}
``````

• So the point is that the array rotate in the pivot 0.I think I got that.
And I found another solution which edit the while condition,so the line
read "while(left<right && nums[left] > nums[right])".It also avoid the un rotated array!

• This post is deleted!

• Is your code can pass [3, 3, 1, 3]?

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.