Skip to content

Latest commit

 

History

History
18 lines (15 loc) · 202 Bytes

search-in-rotated-sorted-array.md

File metadata and controls

18 lines (15 loc) · 202 Bytes

Code

func search(nums []int, target int) int {
	for i, num := range nums {
		if num == target {
			return i
		}
	}
	return -1
}

Solution in mind

  • Naive linear search