Bit Magic - Basic Articles
Given an array, initially consisting of 0 as the only element present and Q operations of the following two types: Add(X): Insert X into the… 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 size N, our task is to find the length of the largest subset such that all elements in the subset… 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 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: Odd… Read More
Given an integer N, the task is to find the greatest number that can be obtained by flipping at most K bits in the binary… Read More
Given two integer N and K, the task is to find the value of N XOR N XOR N XOR N … XOR N (K… 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 positive integers A and B. Let’s define D such that B AND D = D. The task is to maximize the expression A… Read More
Given two integers A and B, the task is to count the number of bits needed to be flipped to convert A to B.Examples:   Input:… 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, R… 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