首页
Python
Java
前端
数据库
Linux
Chatgpt专题
开发者工具箱
leetcode81专题
Leetcode81: Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in the array.
阅读更多...
leetcode81 搜索旋转排序数组 II
文章目录 1. 解法2. 原题 [81. 搜索旋转排序数组 II](https://leetcode.cn/problems/search-in-rotated-sorted-array-ii/) 1. 解法 使用二分查找,对于当前中点mid, 如果它指向的值小于等于右端right,说明右区间是排好序的;反之,那么说明左区间是排好序的。 如果目标值位于排好序的区间内,可以对
阅读更多...