Category Archives: Bit Magic

Given a XOR linked list and an integer K, the task is to reverse every K nodes in the given XOR linked list. Examples: Input:… Read More
Given an array arr[] of size N, the task is to empty given array by removing 2i – 1 array elements in each operation (i… Read More
Given an array arr[] of size N, the task is to check if any subarray of size K exists in the array or not, whose… Read More
Given a matrix B[][] of dimensions N * M, the task is to generate a matrix A[][] of same dimensions that can be formed such… 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 a XOR linked list, the task is to reverse the XOR linked list. Examples: Input: 4 <–> 7 <–> 9 <–> 7Output: 7 <–>… Read More
Given an array arr[] of size N and a positive integer K, the task is to check if the array can be split into K… Read More
Given a binary matrix M[][] of dimensions N x N, the task is to make every pair of adjacent cells in the same row or… Read More
Given two arrays arr1[] of size M and arr2[] of size N, the task is to find the sum of bitwise AND of each element… Read More
Given an array Arr[] of N ( 1 ≤ N ≤ 105)integers, the task is to generate an array B[] consisting of N non-zero elements,… Read More
Given an integer N, the task is to find the decimal value of the binary string formed by concatenating the binary representations of all numbers… Read More
Given an integer N, the task is to find the minimum number of coins of the form 2i required to make a change for N… Read More
Given two numbers A and B, the task is to count the number of set bits in A and B and flip the bits of… Read More
Given a 2D matrix mat[][] of size N * M, the task is to find the median of Bitwise XOR of all possible submatrices from… Read More