您的位置:首页 > 职场人生

lintcode->落单的数

2016-12-16 12:03 155 查看
package 落单的数;

public class Solution {

public int singleNumber(int[] A) {
// Write your code here
int ans = 0;
for(int i:A){
ans ^= i;
}
return ans;
}
public static void main(String[] args) {
int[] A = {1,2,3,1,2};
System.out.println(new Solution().singleNumber(A));
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息