mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-08 10:15:51 +08:00
Add find non repeating number algorithm (#4328)
This commit is contained in:

committed by
GitHub

parent
52f365a915
commit
b4f786369b
@ -0,0 +1,17 @@
|
||||
package com.thealgorithms.bitmanipulation;
|
||||
|
||||
/**
|
||||
* Find Non Repeating Number
|
||||
* @author Bama Charan Chhandogi (https://github.com/BamaCharanChhandogi)
|
||||
*/
|
||||
|
||||
public class NonRepeatingNumberFinder {
|
||||
|
||||
public static int findNonRepeatingNumber(int[] arr) {
|
||||
int result = 0;
|
||||
for (int num : arr) {
|
||||
result ^= num;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user