# Category Archives: Bit Magic

Given positive integers N, X and Y. The task is to find the count of unique binary strings of length N having X 0s and… Read More
Given three numbers N, X, and Y, find the count of unique binary strings of length N having at least X 0s and Y 1s.… Read More
Given a number N, the task is to find the total number of balanced binary strings possible of length N. A binary string is said… Read More
Given a binary string str[] of size N. The task is to find the longest balanced substring. A substring is balanced if it contains an… Read More
Given a binary string str consisting of only 0 and 1, where 0 represent an unoccupied position and 1 represent an occupied position. Two players… Read More
Given an array arr[] of N integers, the task is to find the size of the largest subset such that the bitwise AND of all… Read More
Given an array of integers, arr[] of size N (<=16), the task is to partition the array into 2 parts such that the maximum product… 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 a binary array a[] of size N of 1’s and 0’s. The task is to remove an element if a[i-1]+a[i]+a[i+1] is divisible by 3.… Read More
Given two positive integers x and y, check if one integer is obtained by rotating bits of other.  Input constraint: 0 < x, y <… Read More
Given two positive integers x and y, check if one integer is obtained by rotating bits of other.  Input constraint: 0 < x, y <… Read More
Given two positive integers x and y, check if one integer is obtained by rotating bits of other.  Input constraint: 0 < x, y <… 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 an array vec[] of size N of non-negative integers. The task is to count the number of subsequences with the sum equal to S… Read More
Given an array arr[] of N integers, the task is to find the Kth lexicographically smallest subset of the given array. Example: Input: arr[] =… Read More