# Category Archives: Bit Magic

Given an array arr[] of size N ( N is even ), the task is to construct an array B[] such that the sum of… Read More
Given integers L and R, the task for this problem is to find a number of integers in the range L to R whose sum… Read More
Given an array arr[] of length N, the task is to find all the possible odd-length subsequences containing odd elements only. Examples: Input: N =… Read More
Given arrays Arr[] and Queries[] of size N and an integer K such that (0 ≤ Arr[i], Queries[i] < 2K), the task is to form… Read More
Given the number N, count the number of ways to create a binary string (the string that contains characters as zero or one) of size… Read More
Given three integers A, B, and C. the task is to find the maximum possible sum of three numbers when you are allowed to perform… Read More
Given 2 arrays arr1[] and arr2[], of size N and M respectively, the task is to find a pair of value (say a and b)… Read More
Given two values A and B (A, B < 16), the task is to store the numbers in one byte.  Examples: Input: A = 5,… Read More
Given an integer N, the task is to find the number of pairs (say {a, b})from 1 to N (both inclusive) that satisfies the condition: … Read More
Given a positive integer array arr[] of size N, the task is to find the longest subarray such that the bitwise AND of every pair… Read More
Given a number N and its reverse R. The task is to find the number obtained when the number is raised to the power of… Read More
Given three arrays arr1[], arr2[], and arr3[] consisting of non-negative integers. The task is to find the bitwise XOR of the XOR of all possible… Read More
Two players, Player 1 and Player 2, are given an integer N to play a game. The rules of the game are as follows : … Read More
Given a binary string str, the task is to find the minimum operations required to convert the binary string in a non-decreasing manner such that… Read More
Given a binary array A[] and an integer X, the task is to check whether it is possible to divide A[] into exactly X non-empty… Read More