## Quotient and remainder dividing by 2^k (a power of 2)

You are given an positive integer n as dividend and another number m (form of 2^k), you have to find quotient and remainder without performing… Read More »

You are given an positive integer n as dividend and another number m (form of 2^k), you have to find quotient and remainder without performing… Read More »

Given an array of n positive elements, find the maximum AND value and the pair of elements generating the maximum AND value from the array.… Read More »

Given a non-negative integer n. The problem is to find the smallest perfect power of 2 which is greater than n without using the arithmetic… Read More »

Write an efficient program to count number of 1s in binary representation of an integer. Examples: Input : n = 6 Output : 2 Binary… Read More »

Given an unsigned integer, reverse all bits of it and return the number with reversed bits. Examples: Input : n = 1 Output : 2147483648… Read More »

Prerequisites: Sprague Gruncy theorem Grundy Numbers Nim is a famous game in which two players take turns removing items from distinct piles. During each turn,… Read More »

Given an array of n-elements, we have to find the largest element among them without using any conditional operator like greater than or less than.… Read More »

Given a non-negative number n. The problem is to unset the last m bits in the binary representation of n. Constraint: 1 <= m <=… Read More »

Given a number n, check if it is divisible by 17 using bitwise operators. Examples: Input : n = 34 Output : 34 is divisible… Read More »

Given a number n, print all primes smaller than n. Examples: Input : 30 Output : 2 3 5 7 11 13 17 19 23… Read More »

Given n, find the greatest number which is strictly not more then n and whose binary representation consists of m consecutive ones, then m-1 consecutive… Read More »

We are given an array of n positive elements. we need to find the maximum AND value generated by any pair of element from the… Read More »

Given a positive integer ‘l‘ and ‘r‘. Find the smallest number ‘n‘ such that l <= n <= r and count of number of set… Read More »

Given a number N, check if it is positive, negative or zero without using conditional statements. Examples: Input : 30 Output : 30 is positive… Read More »

Given a binary array, we can flip all the 1 are in the left part and all the 0 to the right part.Calculate the minimum… Read More »