Hello everyone ... Here we are going to solve a Competitive Programming problem related to Bit Manipulation. Problem Statement Given an array A containing 2*N+2 positive numbers, out of which 2*N numbers exist in pairs whereas the other 2 numbers occur exactly once and are distinct . Find the two non-repeating numbers. Examples Input: N = 2 arr[] = {1, 2, 3, 2, 1, 4} Output: 3 4 Explanation: 3 and 4 occur exactly once. Input: N = 1 arr[] = {2, 1, 3, 2} Output: 1 3 Explanation: 1 3 occur exactly once. Constraints 1 <= Length of array <= 10 6 1 <= Elements in array <= 5 * 10 6 Expectations Expected Time Complexity: O(N) Expected Space Complexity: O(1) Problem Link : https://practice.geeksforgeeks.org/problems/finding-the-numbers0215/1 Solution The first idea that might come to your mind is to use Sorting and comparing adjacent elements in the sorted array to find the non-repeating elements. This solution's time compl...
Application Security, Competitive Programming, Linux and Technology