Given a positive integer N, the task is to find the two smallest integers A and B such that the Bitwise XOR of A and… Read More

# Category Archives: Bit Magic

Given two integers N and K, the task is to find the number of N-length arrays that satisfies the following conditions: The sum of the… Read More

Given a positive integer N, the task is to count the number of N-digit numbers such that the count of distinct odd and distinct even… Read More

Given two binary arrays, A[] and B[] of size N respectively, the task is to find the number of elements in array A[] that will… Read More

Given a binary string str[] of size N and an integer M. This binary string can be modified by flipping all the 0’s to 1… Read More

Given a binary tree, the task is to compress all the nodes on the same vertical line into a single node such that if the… Read More

Given an integer N, the task is to reduce N to 0 in the minimum number of operations using the following operations any number of… Read More

Given a binary string S, the task is to find that the decimal representation of the given binary string is divisible by integer K or… Read More

Given two binary strings s1[] and s2[] of the same length N, the task is to find the minimum number of operations to make them… Read More

Given two positive integers N and K, the task is to find the number of arrays of size N such that each array element lies… Read More

Given an array arr[] consisting of N positive integers and a positive integer X, the task is to find the number of pairs (i, j)… Read More

Given a positive integer N, the task is to print the minimum count of consecutive numbers less than N such that the bitwise AND of… Read More

Given an integer N, the task is to print the count of all the non-negative integers K less than or equal to N, such that… Read More

Given a sorted array arr[] of the first N Natural Numbers and an integer X, the task is to print the last remaining element after… Read More

Given a positive integer N, the task is to count the number of N-digit numbers such that the bitwise AND of adjacent digits equals 0.… Read More