Category Archives: Bit Magic

Given an array arr[] of size N, the task is to replace a pair of array elements whose Bitwise XOR is even by their Bitwise… Read More
Given an array arr[] consisting of N positive integers, replace pairs of array elements whose Bitwise AND exceeds Bitwise XOR values by their Bitwise AND… Read More
Given an array arr[] consisting of N positive integers, the task is to find the maximum absolute difference between the sum of the array elements… Read More
Given a square matrix mat[][] of dimension N*N, convert the elements present in both the diagonals to their respective binary representations and perform the following… Read More
Bit Manipulation is a technique used in a variety of problems to get the solution in an optimized way. This technique is very effective from… Read More
Given a Binary Tree consisting of N nodes, the task is to find the sum of Bitwise AND of the sum of all leaf nodes… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to count the number of subarrays possible consisting of elements… Read More
Given an array arr[] consisting of N positive integers, the task is to modify every array element by reversing them binary representation and count the… Read More
Given two integers N and S, the task is to find a circular permutation of numbers from the range [0, 2(N – 1)], starting with… Read More
Given an array arr[] of size N, the task is to find the maximum and minimum sum of Bitwise XOR of all pairs from an… Read More
Given an array arr[] of size N, the task is to count the number of subarrays from the given array having odd Bitwise XOR value.… Read More
Given an integer N, the task is to find the number of trailing zeroes in the binary representation of the given number. Examples: Input: N… Read More
Given two integers L and R, the task is to find the count of even and odd Bitwise XOR values of consecutive numbers from the… Read More
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
Given an integer N, the task is to generate an N-digit number which is comprising only of digits 1 or 2 and is divisible by… Read More