LeetCode 136 Single Number
2016-04-10 13:26
411 查看
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
public int singleNumber(int[] nums) { int k = 0; for (int i = 0; i <nums.length ; i++) { k = k^nums[i]; } return k; }
相关文章推荐
- 20145232 韩文浩 实验一
- Hbase集群安装步骤
- 微软必应搜索支持源代码搜索和运行了
- java学习笔记(九)
- 邁向IT專家成功之路的三十則鐵律 鐵律五:IT人穩定發展之道-去除惡習
- IDEA从远程SVN仓库克隆项目
- PHP不使用递归的无限级分类
- 22. Generate Parentheses
- 《JavaScript忍者秘籍》笔记
- IP地址
- C++学习——带默认值参数的函数
- metasploit 中nessus nessus_connect问题:You must do this before any commands
- 时间问题
- 解读HTTP与HTTPS的区别
- CSS3---圆角设置
- 双系统linux+win之血的教训
- 图解二叉树的遍历
- ios app 上传时 ERROR ITMS-90096
- 罗马数字问题
- NuttX_debug系统