找出数组中只出现一次的数字
2017-03-21 13:54
381 查看
public static void getOneTimeNum(int[] array) { if (array == null || array.length < 1) { return; } Map<Integer,Integer> map =new HashMap<Integer, Integer>(); for (int i = 0; i < array.length; i++) { if (map.get(array[i]) == null) { map.put(array[i], 1); } else { map.put(array[i], map.get(array[i]) + 1); } } for (Integer key : map.keySet()) { if (map.get(key) == 1) {//出现一次 System.out.print(key + " "); } } }
本文参考:
http://blog.csdn.net/xidianluke/article/details/38267775
相关文章推荐
- 每天一道算法题10 找出数组中两个只出现一次的数字
- 面试题_找出数组中两个只出现一次的数字
- 一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字
- 找出数组中两个只出现一次的数字
- 找出数组中两个只出现一次的数字
- 找出数组中两个只出现一次的数字
- 程序员面试100题之三十四,找出数组中两个只出现一次的数字
- 【算法14】找出数组中两个只出现一次的数字
- 算法题6 找出整数数组中两个只出现一次的数字
- 找出数组中2个只出现了一次的数字
- 程序员面试题精选100题(34)-找出数组中两个只出现一次的数字
- 找出数组中两个只出现一次的数字 [No. 30]
- 【转帖】找出数组中两个只出现一次的数字
- 找出数组中两个只出现一次的数字--分组异或
- 每天一道算法题10 找出数组中两个只出现一次的数字
- 找出数组中两个只出现一次的数字
- 100题_34 找出数组中两个只出现一次的数字
- 每天一道算法题-1 找出数组中两个只出现一次的数字
- 解题笔记(24)——找出数组中两个只出现一次的数字(数组)
- 找出数组中两个只出现一次的数字