# Tag Archives: XOR

## Find single in an array of 2n+1 integer elementsOctober 21, 2017

Given an array with 2n+1 integers, n elements appear twice in arbitrary places in the array and a single integer appears only once somewhere inside.… Read More »

## Find One’s Complement of an Integer

Given an integer n, find the one’s complement of the integer. Examples: Input : n = 5 Output : 2 Input : n = 255… Read More »

## Check if one of the numbers is one’s complement of the otherOctober 17, 2017

Given two non-negative integers a and b. The problem is to check if one of the two numbers is 1’s complement of the other. The… Read More »

## Maximum possible XOR of every element in an array with another arrayOctober 4, 2017

Two arrays A and B consisting of N elements are given. The task is to compute the maximum possible XOR of every element in array… Read More »

## Find Unique pair in an array with pairs of numbersOctober 3, 2017

Given an array where every element appears twice except a pair (two elements). Find the elements of this unique pair. Examples: Input : 6, 1,… Read More »

## Set all the bits in given range of a numberSeptember 19, 2017

Given a non-negative number n and two values l and r. The problem is to set the bits in the range l to r in… Read More »

## Minimum operations to make XOR of array zeroSeptember 18, 2017

We are given an array of n elements. The task is to make XOR of whole array 0. We can do following to achieve this.… Read More »

## Toggle all bits after most significant bitSeptember 14, 2017

Given a number, toggle all bits of it after most significant bit including most significant bit. Examples: Input : 10 Output : 5 Binary representation… Read More »

## Position of rightmost common bit in two numbersSeptember 8, 2017

Given two non-negative numbers m and n. Find the position of rightmost same bit in the binary representation of the numbers. Examples: Input : m… Read More »

## Minimum absolute difference of XOR values of two subarraysSeptember 6, 2017

Given an array containing n numbers. The problem is to split the array into two subarrays such that the absolute difference of the xor values… Read More »

## Binary array after M range toggle operationsSeptember 5, 2017

Consider a binary array consisting of N elements (initially all elements are 0). After that you are given M commands where each command is of… Read More »

## Subarray with XOR less than kAugust 6, 2017

Given an array of n numbers and a number k. You have to write a program to find the number of subarrays with xor less… Read More »

## Queries on XOR of greatest odd divisor of the rangeJuly 28, 2017

Given an array of N positive integers. There are Q queries, each include a range [L, R]. For each query output the xor of greatest… Read More »

## Ways to remove one element from a binary string so that XOR becomes zeroJuly 19, 2017

Given a binary string, task is to erase exactly one integer in the array so that the XOR of the remaining numbers is zero. The… Read More »

## Count pairs with Odd XORJuly 3, 2017

Given an array of n integers. Find out number of pairs in array whose XOR is odd. Examples: Input : arr[] = { 1, 2,… Read More »