# Category Archives: Bit Magic

Given an integer N, the task is to find the total number of bits toggled to obtain all numbers from 0 to N sequentially. Examples:… Read More
Given Bitwise AND, OR, and XOR of N elements of an array denoted by a, b, c. The task is to find the elements of… Read More
Given a range [L, R], the task is to find a pair (X, Y), not necessarily distinct. Find the maximum possible value of the bitwise… Read More
Given an array arr[] of N positive integers the task is to find the minimum value of Bitwise XOR of Bitwise OR and AND of… Read More
Given an array A[] of size N, find the Maximum Xor Subsequence such that both A [ i ] and A [ N – i… Read More
Given an integer N, the task is to find the numbers which when added after being raised to the Power of 2 gives the integer… Read More
Prerequisite: Bitset function in STL library Given a number N, the task is to find the absolute difference of the number of set and unset bits… Read More
Given an array arr[], the task is to count the number of the unique arrays can be formed by updating the elements of the given… Read More
Given an integer N, the task is to flip all the bits to the left of rightmost set bit and print the number generated. Examples:… Read More
Given an array A[] of length N, where N is an even number, the task is to answer Q independent queries where each query consists… Read More
There is a series of numbers that have only digits, 4 and 7, and numbers are arranged in increasing order. The first few numbers of… Read More
Given a string S, the task is to find minimum flips required to convert an initial binary string consisting of only zeroes to S where… Read More
Given an array arr[] and an integer K, the task is to count subarrays of size K in which every element appears an even number… Read More
Given a binary array arr, the task is to find the maximum number of 0s that can be flipped such that the array has no… Read More
Given an integer array arr[] of consisting of N integers, the task is check if it is possible to divide the given array into K… Read More