摘要: 前序遍历+排序. 时间复杂度: O(nlogn) 空间复杂度: O(n) 1 class Solution { 2 private int res=Integer.MAX_VALUE; 3 private ArrayList<Integer> arry=new ArrayList<>(); 4 pu 阅读全文
posted @ 2019-12-14 15:18 Chenjin123 阅读(333) 评论(0) 推荐(0) 编辑
摘要: 哈希表,暴力. 1 class Solution { 2 public int singleNumber(int[] nums) { 3 Set<Integer> map=new HashSet<>(); 4 for(int num:nums){ 5 if(map.contains(num)){ 6 阅读全文
posted @ 2019-12-14 14:25 Chenjin123 阅读(179) 评论(0) 推荐(0) 编辑