Given an array of integers where every integer occurs three times except for one integer, which only occurs once, find and return the non-duplicated integer.
For example, given [6, 1, 3, 3, 3, 6, 6], return 1. Given [13, 19, 13, 13], return 19.
Do this in O(N) time and O(1) space.
One solution which I can think is as below, please comment your thoughts -
For example, given [6, 1, 3, 3, 3, 6, 6], return 1. Given [13, 19, 13, 13], return 19.
Do this in O(N) time and O(1) space.
One solution which I can think is as below, please comment your thoughts -
Few other ideas one can see at -
https://www.geeksforgeeks.org/find-the-element-that-appears-once/
One brilliant solution from above page is -
https://www.geeksforgeeks.org/find-the-element-that-appears-once/
One brilliant solution from above page is -