Bit Magic - Basic Articles
Given an integer N, the task is to find the smallest number K such that bitwise AND of all the numbers in range [N, N-K]… 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 an array arr[] of length N, the task for every array element is to print the sum of its Bitwise XOR with all other… Read More
Given an array arr[] of size N and an integer K, the task is to find the length of the longest subarray having Bitwise XOR… Read More
Given two integers X and Y, representing Bitwise XOR and Bitwise AND of two positive integers, the task is to calculate the Bitwise OR value… Read More
Given an integer N, the task is to print the number obtained by unsetting the least significant K bits from N. Examples: Input: N =… 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 A[] of integers and array Q consisting of queries of the following two types: (1, L, R) : Return XOR of all… Read More
Given an array A, consisting of N non-negative integers, find the sum of xor of all unordered triplets of the array. For unordered triplets, the… Read More
Given an array arr and a number K, find the new array formed by performing XOR of the corresponding element from the given array with… Read More
Given a number N, the task is to find the remainder when N is divided by 4 using Bitwise AND operator.Examples:   Input: N = 98… Read More
Given a binary string of size N and an integer K, the task is to perform K operations upon the string and print the final… Read More
Given an array arr[] containing integers of size N, the task is to find the XOR of this array.Examples:   Input: arr[] = {2, 4, 7} Output:… Read More
Given a number N, the task is to check whether the number is even or odd using Bitwise Operators.Examples:   Input: N = 11 Output: OddInput: N… Read More
Given a positive integer X the task is to find an integer Y such that:   The count of set bits is Y is equal to… Read More
Given two integers L and R, the task is to find the XOR of elements of the range [L, R]. Examples :‘   Input: L = 4,… Read More
Given two integers N and K, the task is to find N distinct integers whose bit-wise OR is equal to K. If there does not… Read More
Given a integer N, the task is to multiply the number with 15 without using multiplication * and division / operators. Examples: Input: N =… Read More
Given an array of integers, the task is to find the AND of all elements of each subset of the array and print the minimum… Read More
Given an array, a[] consists of only 0 and 1. The task is to check if it is possible to transform the array such that… Read More