An array has a repeat number, the space complexity of O (1), the time complexity of O (n) to identify the duplicate numbers.
public class QuChong { public static void main (String [] args ) { int n-= . 4 ; int [] ARR = { . 1 , 2 , . 3 , 2 } ; int X = 0 ; for ( int I = 0 ; I <= n-- . 1 ; I ++ ) { X = I X ^ ; } for ( int I = 0 ; I <n- ; I ++ ) { X = X ^ ARR [I ]
;
}
System.out.println(x);
}
}
Find duplicate numbers array
Guess you like
Origin www.cnblogs.com/zhaofeng555/p/11391056.html
Recommended
Ranking