0
点赞
收藏
分享

微信扫一扫

leetcode-33-Search in Rotated Sorted Array

九点韶留学 2023-08-23 阅读 56


Use the most understandable method, in binary search, we can know that at least one part is sort in order. Base on that, we just need to care about the part is sorted, if current target is in that part, narrow the index within such range, otherwise go to the other part.

At first I cannot understand such concept, so I just compare the neighbor of the middle point. It is a good lesson for me to learn about binary search.

The reason I wrong is that I do not make the condition clearly, we should specify the range which is sorted then check if current number is in that sort.


举报

相关推荐

0 条评论