## Find two numbers from their sum and XOR

Given the sum and xor of two numbers X and Y s.t. sum and xor , we need to find the numbers minimizing the value… Read More »

Given the sum and xor of two numbers X and Y s.t. sum and xor , we need to find the numbers minimizing the value… Read More »

Given a string s, print all possible subsequences of the given string in an iterative manner. We have already discussed Recursive method to print all… Read More »

Given a binary string, we need to check whether that number is divisible by 64 or not after removing of some bits. If yes then… Read More »

Given a number n, a position p and a binary value b, we need to change the bit at position p in n to value… Read More »

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

CHAR_BIT : It is the number of bits in char. These days, almost all architectures use 8 bits per byte (But it is not the… Read More »

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

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 »

Prerequisites : Bitwise operators in C, Bitwise Hacks for Competitive Programming, Bit Tricks for Competitive Programming Compute XOR from 1 to n (direct method) :… Read More »

Given an array which contains all elements occurring k times, but one occurs only once. Find that unique element. Examples: Input : arr[] = {6,… Read More »

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 »

Given a positive integer n. The problem is to check whether only the first and last bits are set in the binary representation of n.… Read More »

Given a positive integer n. The problem is to check whether this integer has an alternate pattern in its binary representation or not. Here alternate… Read More »

Given two non-negative integers m and k. The problem is to find the m-th smallest number having k number of set bits. Constraints: 1 <=… Read More »

Given two positive integer a and b you have to change a to b by applying any of the three operations on binary form of… Read More »