Given an integer, count the number of trailing zeroes. For example, for n = 12, its binary representation is 1100 and number of trailing zero… Read More

# Category Archives: Bit Magic

Given a sequence of three binary sequences A, B and C of N bits. Count the minimum bits required to flip in A and B… Read More

Given a positive integer n, count numbers x such that 0 < x <n and x^n > n where ^ is bitwise XOR operation.Examples: Input… Read More

Stream of binary number is coming, the task is to tell the number formed so far is divisible by a given number n. At any… Read More

For any given two numbers n and m, you have to find n*m without using any multiplication operator. Examples : Input: n = 25 , m… Read More

It was really good experience at Qualcomm. I was interviewed for Associate Software Engineer and have an experience of an year, first by telephonic round… Read More

Given a Binary Number as string, print its 2’s complements.2’s complement of a binary number is 1 added to the 1’s complement of the binary… Read More

Given two integers A & B. Task is to check if A and B are same or not without using comparison operators.Examples: Input : A… Read More

Given a integer n > 0, the task is to find whether in the bit pattern of integer count of continuous 1’s are in increasing… Read More

Given an integer n > 0, the task is to find whether this integer has an alternate pattern in its bits representation. For example- 5… Read More

Given a number n, find the highest power of 2 that is smaller than or equal to n. Examples : Input : n = 10… Read More

Given an array arr[] and a number of queries, where in each query we have to check whether a subset whose sum is equal to… Read More

Given a number n, the task is to find the maximum 0’s between two immediate 1’s in binary representation of given n. Return -1 if… Read More

Given a number, the task is to find XOR of count of 0s and count of 1s in binary representation of a given number. Examples: Input… Read More

As we know that every number can be represented as sum(or difference) of powers of 2, therefore what we can do is represent the constant… Read More