mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-22 11:46:34 +08:00
20 lines
430 B
Java
20 lines
430 B
Java
package com.thealgorithms.bitmanipulation;
|
|
|
|
/**
|
|
* Find Non Repeating Number
|
|
* @author Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
|
|
*/
|
|
|
|
public final class NonRepeatingNumberFinder {
|
|
private NonRepeatingNumberFinder() {
|
|
}
|
|
|
|
public static int findNonRepeatingNumber(int[] arr) {
|
|
int result = 0;
|
|
for (int num : arr) {
|
|
result ^= num;
|
|
}
|
|
return result;
|
|
}
|
|
}
|