2014年1月19日

LeetCode: Single Number I & II

摘要: Given an array of integers, every element appearstwiceexcept for one. Find that single one.这个方法重来没见过,以后估计也不会再见了。。1 public static int singleNumber(int[] A) {2 int sum = 0;3 for (int a : A) {4 sum ^= a;5 }6 return sum;7 }本以为不会再见了,不过看到第二个,觉得位操作还是有些应用的。。。。... 阅读全文

posted @ 2014-01-19 11:31 longhorn 阅读(264) 评论(0) 推荐(0) 编辑

导航