# Category Archives: Bit Magic

Given a number N, the task is to calculate the total number of corresponding different bit in the binary representation for every consecutive number from… Read More
Given an array arr[] of positive integers and a number K, the task is to find the minimum and maximum values of Bitwise operation on… Read More
Given a natural number N, the task is to find a number M smaller than N such that the difference between their bitwise XOR (N… Read More
Given an integer N, the task is to find the number of possible binary strings of length N with an equal frequency of 0‘s and… Read More
Given a binary array arr[] of length N, and an integer K, the task is to find the maximum number of consecutive ones after flipping… Read More
Given an integer N, the task is to find the maximum frequency of set bits among all pairs of integers from 0 to N that… Read More
Give binary string str and an integer N, the task is to check if the substrings of the string contain all binary representations of non-negative… Read More
Given two integers A and N, the task is to calculate A raised to power N (i.e. AN). Examples:  Input: A = 3, N =… Read More
Given a binary tree, the task is to find the total count of set bits in the node values of all the root to leaf… Read More
Given an array arr[], and queries Q[][] of the form (l, r, val), the task for each query is to update all the elements in… Read More
Given an integer N, the task is to find the number of binary strings possible of length N having same frequency of 0s and 1s.… Read More
Given an array arr[] of N positive integers, the task is to find the length of the longest subsequence such that Bitwise XOR of all… Read More
Given an array arr[] of N strings. The task is to find the count of all possible pairs of strings such that their concatenations has… Read More
Given an integer N which can be represented in 32 bit, the task is to find another integer X that has at most K bits… Read More
Given an array arr[] of size N and a matrix Q consisting of queries of the following two types:  1 L R : Print the… Read More