Bit Magic - Basic Articles
Given an array arr[] of size N and an integer K, the task is to find the count of all the ordered pairs (i, j)… Read More
Given an integer N, the task is to find all possible integer M in the range [2, N] such that the bitwise OR of all… Read More
Over the network, messages are sent as data packets. Each data packet is a series of bytes (8bits = 1 byte). The task is to… Read More
Given an integer N., The task is to find the number of distinct permutations of length N, such that the bitwise AND value of each… Read More
Given an array a[] of size N and an integer K, the task is to find a value X in the range [0, K] which… Read More
Given two binary matrices A[] and B[] of dimension N * M and a positive integer K, the task is to find the minimum number… Read More
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 a binary string S of size N, the task is to find the number of groups of 1s only in the string S. Examples:… 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 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 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
Binary Coded Decimal, or BCD, is another process for converting decimal numbers into their binary equivalents.   It is a form of binary encoding where each… 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