
BinarySearch
文章平均质量分 51
CrazyAoli
这个作者很懒,什么都没留下…
展开
-
BinarySearch[5]34. Find First and Last Position of Element in Sorted Array
Thoughts:The main problem , is to solve the condition that mid == target.If mid == target, we need find the range of the target.So how to find the range of the target?1.Binary Search Solution1Problem: too many codes.class Solution { public int[]原创 2021-01-21 11:59:50 · 108 阅读 · 0 评论 -
BinarySearch[4]153. Find Minimum in Rotated Sorted Array
1.Simple Easy Thinking SolutionBinary SearchTime Complexity: O(logn)class Solution { public int findMin(int[] nums) { // The difference between 33. Search in Rotated Sorted Array and this one is: // This question find the mim and the o原创 2021-01-21 04:18:38 · 157 阅读 · 0 评论 -
BinarySearch[3]Leetcode852. Peak Index in a Mountain Array
Description[Easy]Let’s call an array arra mountain if the following properties hold:arr.length >= 3There exists some i with 0 < i < arr.length - 1 such that:arr[0] < arr[1] < ... arr[i-1] < arr[i]arr[i] > arr[i+1] > ... >原创 2021-01-20 23:13:38 · 178 阅读 · 1 评论