当前位置:网站首页>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 …
边栏推荐
- Pat grade A - 1164 good in C (20 points)
- In 2022, 6G development has indeed warmed up
- What are the common computer problems and solutions
- DR-AP40X9-A-Qualcomm-IPQ-4019-IPQ-4029-5G-4G-LTE-aluminum-body-dual-band-wifi-router-2.4GHZ-5GHz-QSD
- Recursion and recursion
- ThreadLocal function, scene and principle
- Classification and extension of OC
- Some 5000+ likes, the development notes of a director of cosmic factory, leaked
- Format cluster and start cluster
- Blue Bridge Cup Guoxin Changtian single chip microcomputer -- led lamp module (V)
猜你喜欢

Format cluster and start cluster

Leetcode week 4: maximum sum of arrays (shape pressing DP bit operation)

In VS_ In 2019, scanf and other functions are used to prompt the error of unsafe functions

webAssembly

Ppt image processing

Runtime. getRuntime(). totalMemory/maxMemory()

BUUCTF,Misc:LSB

How to switch between dual graphics cards of notebook computer

How to connect a laptop to a projector

Hcip 13th day notes
随机推荐
[sg function] 2021 Niuke winter vacation training camp 6 h. winter messenger 2
2022 safety officer-b certificate examination summary and safety officer-b certificate simulation test questions
The latest analysis of R1 quick opening pressure vessel operation in 2022 and the examination question bank of R1 quick opening pressure vessel operation
油猴插件
2022 safety officer-a certificate registration examination and summary of safety officer-a certificate examination
How to restore the factory settings of HP computer
DR-NAS26-Qualcomm-Atheros-AR9582-2T-2R-MIMO-802.11-N-5GHz-high-power-Mini-PCIe-Wi-Fi-Module
2022 high altitude installation, maintenance and removal of examination question bank and high altitude installation, maintenance and removal of examination papers
How about agricultural futures?
IO flow review
Can you draw with turtle?
Covariance
股票炒股开户注册安全靠谱吗?有没有风险的?
JS Demo calcule combien de jours il reste de l'année
Ppt image processing
Buuctf, web:[geek challenge 2019] buyflag
MLX90614 driver, function introduction and PEC verification
Codeforces Round #768 (Div. 1)(A-C)
How to solve the problem of requiring a password when accessing your network neighborhood on your computer
Uboot migration