当前位置:网站首页>Day30-t540-2022-02-14-don't answer by yourself
Day30-t540-2022-02-14-don't answer by yourself
2022-07-03 22:41:00 【Parchment】
540 A single element in an ordered array
Give you an ordered array of integers only , Each of these elements will appear twice , Only one number will appear once .Please find and return the number that only appears once .
The solution you design must meet O(log n) Time complexity and O(1) Spatial complexity .
source : Power button (LeetCode)
link :https://leetcode-cn.com/problems/single-element-in-a-sorted-array
class Solution:
def singleNonDuplicate(self, nums: List[int]) -> int:
return nums[bisect_left(range(len(nums) - 1), True, key=lambda x: nums[x] != nums[x ^ 1])]
# author :himymBen
# link :https://leetcode-cn.com/problems/single-element-in-a-sorted-array/solution/pythonjavajavascriptgo-er-fen-cha-zhao-b-l76s/
leetcode It's been a day , Let me slowly …
边栏推荐
- 油猴插件
- How to solve the problem of computer networking but showing no Internet connection
- How can enterprises and developers take advantage of the explosion of cloud native landing?
- Flutter internationalized Intl
- Oil monkey plug-in
- Ppt image processing
- Analysis report on the development prospect and investment strategy of global and Chinese modular automation systems Ⓟ 2022 ~ 2027
- Electronic tube: Literature Research on basic characteristics of 6j1
- IDENTITY
- ThreadLocal function, scene and principle
猜你喜欢
Preliminary analysis of smart microwave radar module
Correlation
What indicators should be paid attention to in current limit monitoring?
2022 free examination questions for safety management personnel of hazardous chemical business units and reexamination examination for safety management personnel of hazardous chemical business units
Blue Bridge Cup -- guess age
Exness: the Central Bank of England will raise interest rates again in March, and inflation is coming
JS closure knowledge points essence
Flutter internationalized Intl
IPhone development swift foundation 09 assets
Quick one click batch adding video text watermark and modifying video size simple tutorial
随机推荐
Summary of fluent systemchrome
Hcip 13th day notes
[Android reverse] application data directory (files data directory | lib application built-in so dynamic library directory | databases SQLite3 database directory | cache directory)
Creation of the template of the password management software keepassdx
C3p0 connection MySQL 8.0.11 configuration problem
Data consistency between redis and database
6.0 kernel driver character driver
Is it safe and reliable to open an account and register for stock speculation? Is there any risk?
AST (Abstract Syntax Tree)
Subset enumeration method
finalize finalization finally final
MLX90614 driver, function introduction and PEC verification
WFC900M-Network_ Card/Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-900M-high-power-Mini-PCIe-Wi-Fi-Mod
Sort merge sort
To rotate 90 degrees clockwise and modify the video format
Morning flowers and evening flowers
2022 electrician (elementary) examination questions and electrician (elementary) registration examination
pycuda._ driver. LogicError: explicit_ context_ dependent failed: invalid device context - no currently
2022 safety officer-b certificate examination summary and safety officer-b certificate simulation test questions
2 spark environment setup local