Skip to content

Latest commit

 

History

History
57 lines (30 loc) · 1.05 KB

README_EN.md

File metadata and controls

57 lines (30 loc) · 1.05 KB

中文文档

Description

Given a sorted array of n integers that has been rotated an unknown number of times, write code to find an element in the array. You may assume that the array was originally sorted in increasing order. If there are more than one target elements in the array, return the smallest index.

Example1:

 Input: arr = [15, 16, 19, 20, 25, 1, 3, 4, 5, 7, 10, 14], target = 5

 Output: 8 (the index of 5 in the array)

Example2:

 Input: arr = [15, 16, 19, 20, 25, 1, 3, 4, 5, 7, 10, 14], target = 11

 Output: -1 (not found)

Note:

  1. 1 <= arr.length <= 1000000

Solutions

Python3

Java

...