28 Jun 2019

Odd one out.

Problem Statment : Find the element which occurs once where as other numbers appears N Times in an array

For example here [5, 5, 4, 8, 4, 5, 8, 9, 4, 8] all the number appear 3 times except 9 which appears 1 time.

Solution : 

This problem can be solved using bit operation in a very efficient way

Time Complexity : O(n)
Space : O(1)

Code Below :


Please post your comments and suggestions.
Happy Coding !! :)



1 comment: