Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7f040fc

Browse files
Update README.md
1 parent b7236cf commit 7f040fc

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

‎README.md‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4087,7 +4087,20 @@ class RandomizedSet:
40874087
寻找的索引 = bisect.bisect_left(self, True, 0, len(nums) - 1)
40884088
```
40894089
- 搜索范围为 [0, len(nums) - 1],注意此处为闭区间
4090-
- :tophat:【非内置公式】
4090+
- :tophat:【非内置公式A】
4091+
```python
4092+
class Solution:
4093+
def 二分查找二岔模板(self, nums: List[int], target: int):
4094+
l, h = 0, len(nums)
4095+
while l < h:
4096+
m = (l + h) // 2
4097+
if 必须向左搜索的条件:
4098+
h = m
4099+
else:
4100+
l = m + 1
4101+
return l - 1
4102+
```
4103+
- :tophat:【非内置公式B】
40914104
```python
40924105
class Solution:
40934106
def 二分查找二岔模板(self, nums: List[int], target: int):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /