当前位置:网站首页>Leetcode-136-a number that appears only once
Leetcode-136-a number that appears only once
2022-07-27 21:04:00 【z754916067】
subject

Ideas
- requirement : Linear time complexity . And it doesn't use extra space to achieve .
- Oh, this question uses XOR , I seem to have done this question during the interview … Completely forgotten
Code
public int singleNumber(int[] nums) {
// That is to say, only traverse once Find the number The hash table does not meet the requirements of spatial complexity
int a=0;
for(int i=0;i<nums.length;i++){
a = a ^ nums[i];
}
return a;
}
边栏推荐
- Do you know about data synchronization?
- 文件上传绕过WAF的技巧大全
- CPDA | how to have data analysis thinking?
- 好开不贵,舒适安全!深度体验比亚迪宋Pro DM-i
- LeetCode每日一练 —— 链表中倒数第 k 个结点
- Programmer growth Chapter 18: project launch
- Openresty Lua resty DNS domain name resolution
- 82.(cesium篇)cesium点在3d模型上运动
- LeetCode每日一练 —— 203. 移除链表元素
- 获取委托中注册的方法
猜你喜欢
随机推荐
Hexagon_ V65_ Programmers_ Reference_ Manual(7)
基于文件上传漏洞获得网站 shell 权限
程序放在哪儿?
R语言使用t.test函数执行t检验验证总体均值是否是某个特定的值(从样本集推论总体均值)
LabVIEW学习笔记五:按钮按下后无法返回原状
最新版web漏洞扫描工具AppScan\AWVS\Xray安装及使用教程
力扣解法汇总592-分数加减运算
征服所有程序员的3件IT装备 →
Repeated DNA sequence [hash determination repetition + sliding window + bit operation of binary coding]
[deep learning] pytoch tensor
怎样实现文档协同?
LeetCode-136-只出现一次的数字
如何查看蓝牙耳机的蓝牙版本
SLIM:自监督点云场景流与运动估计(ICCV 2021)
R语言dplyr包进行数据分组聚合统计变换(Aggregating transforms)、计算dataframe数据的分组加和值(sum)
一文了解Pycharm快捷键
LeetCode每日一练 —— CM11 链表分割
[today in history] July 27: model testing pioneer was born; Microsoft acquires qdos; The first laser typesetting Chinese newspaper
LeetCode每日一练 —— 206. 反转链表
LeetCode每日一练 —— 21. 合并两个有序链表
![[deep learning] pytoch tensor](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)








![[Numpy] 数组属性](/img/eb/a27c24deeb7951828cdfbaa88c059c.png)