Given an array arr[] of size N, the task is to find if there exists a pair in the array, such that their bitwise XOR… Read More

# Category Archives: Bit Magic

Given an integer K and an array arr[] of size N, the task is to choose two elements from the array in such a way… Read More

Given a binary matrix arr[][] of N rows and M columns. The task is to find the number of cells in the matrix, where Bitwise… Read More

Given an array arr[] containing N positive integers, the task is to add an integer such that the bitwise Xor of the new array becomes… Read More

Given an integer N, the task is to count the number of integers (say x) in the range [0, 2N−1] such that x⊕(x+1) = (x+2)⊕(x+3).… Read More

Given a number N, the task is to find the number of zero’s in base K representation of the given number, where K > 1.… Read More

Given a positive integer N, the task is to find the minimum number of subtractions of power of 2 required to convert N to 0.… Read More

Given an integer N, the task is to find all possible integer M in the range [2, N] such that the bitwise OR of all… Read More

Given an array arr[] which contains N positive integers and an integer K. The task is to count all triplets whose XOR is equal to… Read More

Given two positive integers A and B. The task is to make them equal using minimum operations such that: A = A + 1 (increase… Read More

Two integers X and Y are the task is to find the number of bits that are same in their binary representation by not considering… Read More

Given a binary array arr[] of size N and an integer K, the task is to check whether the binary array can be turned into… Read More

Given a binary string S of length N, consisting of 0s and 1s. The task is to count the number of triplet (i, j, k)… Read More

Given an array arr[] of size N, the task is to check if the array elements can be rearranged in a way such that the… Read More

Given a singly linked list, the task is to Count the pairs of nodes with greater Bitwise AND than Bitwise XOR. Examples: Input: list: 1->4->2->6->3Output:… Read More