136. Single Number

网友投稿 638 2022-09-04

136. Single Number

136. Single Number

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?

public class Solution { public int singleNumber(int[] A) { int result = A[0]; for (int i = 1; i < A.length; i++) result = result ^ A[i]; return

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:精心整理了一套MySQL 常用命令(请整理一下)
下一篇:141. Linked List Cycle
相关文章

 发表评论

暂时没有评论,来抢沙发吧~