11 2023 档案
力扣-34-在排序数组中查找元素的第一个和最后一个位置
摘要:一、题目 力扣地址:https://leetcode.cn/problems/find-first-and-last-position-of-element-in-sorted-array/description/ 二、解法思路: 也是二分查找相关题目,详细解法看注释 from typing imp
力扣-35-搜索插入位置
摘要:一、题目 力扣地址:https://leetcode.cn/problems/search-insert-position/ 二、解法思路 与标准的二分查找一直,唯一的区别为,若所需target不在nums中,需要找到insert的索引 from typing import List class S
力扣-704-二分查找
摘要:一、题目 力扣链接:https://leetcode.cn/problems/binary-search/description/ 二、解法思路 标准的二分查找题目,常规上有左闭右闭和左闭右开的解法 1、左闭右闭 class Solution: """ leetcode:704 采用左闭右闭的方式,