Algorithm · Microsoft · Hard
Given an integer array nums built by cyclically rotating a non-decreasing array, where repeated values are permitted, return a two-element array [rotation_count, leftmost_index_of_target]. Let $$n = nums.length$$. The rotation count is the smallest index $$r$$ such that $$nums[r] < nums[(r-1+n) \bmod n]$$. If no such $$r$$ exists, the rotation count is 0. This situation includes an already sorted array and an array whose entries are all equal. For an empty array, the…
Checking your access…