# Category Archives: Bit Magic

Given a positive integer value V, the task is to find the maximum XOR of two numbers such that their product is equal to the… Read More
Given an integer n, you need to find the largest integer m (m < n) such that m XOR n is a palindrome. If there… Read More
Given an integer array arr[] of size N, the task is to count the number of pairs whose BITWISE AND and BITWISE XOR are equal.… Read More
Given an array A of N elements. Your task is to output “YES” if you can make all the array elements zero by performing an… Read More
Given two strings s1 and s2, the task is to find the length of the longest common substring of s1 and s2 such that the… Read More
Given three numbers a, b, and m where10^9 ≤ a, b ≤ 10^9. Given very large ‘m’ containing 10^18+7 and m is a prime number,… Read More
Given three distinct integers X, Y, Z. Find an integer N that after performing XOR of each element, integers must follow that X should be… Read More
Given two non-negative integers A and B find the smallest non-negative integer m such that the product of (A & m) and (B & m) is… Read More
Given a number N, the task is to count the occurrences of 101 subsequences in the binary representation of that number. Examples: Input: N =… Read More
Given a string str consisting of digits, the task is to find the number of contiguous substrings such that the substring can be rearranged into… Read More
Given an integer array A of size N, and Q queries. In each query, you are given an integer X. Create a new sequence X^A[i], say… Read More
Given an array arr[] of integers having N elements and a non-weighted undirected graph having N nodes and M edges. The edges are represented as… Read More
Given a non-negative integer n, find the maximum value that can be obtained by unsetting any set bit, such that no three consecutive bits in… Read More
Given a number N, the task is to find four distinct numbers A, B, C, and D such that all are distinct and non-negative satisfies… Read More
Given an integer N, the task is to find X and Y where X is the number of quadruples of positive integers (A, B, C,… Read More