# Category Archives: Bit Magic

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
Given an array of distinct positive integers and a number x, find the number of pairs of integers in the array whose XOR is equal… Read More
Given two non-negative long integers, x and y given x <= y, the task is to find bit-wise and of all integers from x and… Read More
Given a number n, the task is to find the XOR from 1 to n. Examples :  Input : n = 6 Output : 7 //… Read More