# Category Archives: Bit Magic

Given an array arr[] of N integers, the task is to find the number of subsequences of the given array such that their Bitwise AND… Read More
Given a binary string S of size N and an integer K, the task is to find the minimum number of operations required to make… Read More
Given an array arr[] consisting of N positive integers, the task is to find the number of subsequences from the given array whose Bitwise OR… Read More
Given an array arr[] consisting of N positive integers, where N is even, the task is to form N/2 pairs such that the sum of… Read More
Given a binary string S(1-based indexing) of size N, and two positive integers K1 and K2, the task is to find the lexicographically smallest string… Read More
Given a positive integer N and an array arr[] of size K consisting of binary string where each string is of size N, the task… Read More
Given a binary string S consisting of N characters, the task is to find the minimum number of flips required such that there don’t exist… Read More
Given a positive integer N, the task is to find the pair of integers (X, Y) such that the Bitwise XOR of X and Y… Read More
Given two positive integers X and K, the task is to find the Kth smallest positive integer (Y) such that the sum of X and… Read More
Given an integer N, the task is to find the maximum value of K such that N & (N-1) & (N-2) & … & (K)… Read More
Given three numbers N, S and X the task is to find if it is possible to construct a sequence A of length N, where… Read More
Given two positive integers N and K, the task is to count the number of even and odd integers consisting of N bits, out of… Read More
Given a binary string S of size N, the task is to find the minimum cost by swapping every set bit with an unset bit… Read More
Given an array arr[] consisting of N positive integers and an array of queries Q[] of type [L, R], the task is to find the… Read More
Given an array arr[] consisting of N integers and a positive integer K, the task is to find the sum of all the subsets of… Read More