Given an array arr[] consisting of N and an integer K, the task is to print the elements of arr[] whose rightmost set bit is… Read More

# Tag Archives: Bit Algorithms

Given an integer N, the task is to print all the subsets of the set formed by the set bits present in the binary representation… Read More

Given two integers N and K, the task is to find whether it is possible to represent N as the sum of exactly K powers… Read More

Given an array arr[] consisting of non-negative integers, the task for each array element arr[i] is to print the sum of Bitwise OR of all… Read More

Given two integers X and S, the task is to construct a sequence of distinct integers from the range [1, X] such that the sum… Read More

Given a positive integer N, the task is to perform the following sequence of operations on the binary representation of N in C. Finding a… Read More

Given six positive integers representing the Bitwise XOR and Bitwise AND of all possible pairs of a triplet (a, b, c), the task is to… Read More

Given two integers X and Y, representing Bitwise XOR and Bitwise AND of two positive integers, the task is to calculate the Bitwise OR value… Read More

Given two positive integers A and B, the task is to flip the common set bitsin A and B. Examples: Input: A = 7, B… Read More

Given an integer N, the task is to find the minimum positive product of first N – 1 natural numbers, i.e. [1, (N – 1)],… Read More

Given two integers N and K, the task is to find the smallest number greater than N whose Kth bit in its binary representation is… Read More

Given two numbers A and B, the task is to print the string of the smallest possible length which evaluates to the product of the… Read More

Given an integer N, the task is to print the number obtained by unsetting the least significant K bits from N. Examples: Input: N =… Read More

Given a string S of length N which only contains lowercase alphabets. Find the length of the longest substring of S such that the characters… Read More

Given a positive integer N, the task is to find out the sum of all consecutive bit differences from 0 to N. Note: If the bit… Read More