# Category Archives: Bit Magic

Given a string S of length N (1 ≤ N ≤ 103) that consists of a digit from ‘0’ to ‘9’, the task is to… Read More
Given a binary string S of a number N, the task is to find a number X such that we can minimize the value of… Read More
Bit stands for binary digit. A bit is the basic unit of information and can only have one of two possible values that is 0… Read More
Given an array arr[] of length N. You can perform at most K operations on the array of the following type:  Choose an index i… Read More
In a party of N people, each person is denoted by an integer. Couples are represented by the same number. Find out the only single… Read More
Given an array A[] consisting of N elements, the task is to find the minimum length of the subarray starting from each index and the… Read More
Given two integers X and S, the task is to find the minimum length of the sequence of positive integers such that the sum of… Read More
Given an array arr[] of size N and an integer K, the task is to invert the 0 bit (unset bit) of any integer of… Read More
Given an array A[] of size N, the task is to find the last remaining element in a new array B containing all pairwise bitwise… Read More
Given a positive integer N. The task is to print the array in decreasing order in which the numbers are odd powers of 2  and… Read More
Given two positive integers A and B, the task is to find the number of integers X such that (A⊕X ) & B = 0… Read More
The XOR operation between two numbers P and Q can be looked in a different way as the bitwise sum modulo 2 on the bits… Read More
Given a positive integer N, the task is to find all pairs of integers (i, j) from the range [1, N] in increasing order of… Read More
Given binary strings S1 and S2 of length N, the task is to check if S2 can be made equal to S1 by performing the… Read More
Given an array of size N. Consider all the subarrays starting at each index from [0, N – 1]. Determine the length of the smallest… Read More