##
Numbers whose bitwise OR and sum with N are equal
May 7, 2017

Given a non-negative integer N, the task is to find count of non-negative integers less than or equal to N whose bitwise OR and sum… Read More »

May 7, 2017

Given a non-negative integer N, the task is to find count of non-negative integers less than or equal to N whose bitwise OR and sum… Read More »

May 5, 2017

For a given number n, if k-th bit is 0, then toggle it to 1 and if it is 1 then, toggle it to 0.… Read More »

Given a number n, check if k-th bit of n is set or not. Examples: Input : n = 5, k = 1 Output :… Read More »

April 18, 2017

You have an array of N numbers, where N is at most 32,000. The array may have duplicates entries and you do not know what… Read More »

April 10, 2017

Given two positive integers A and B, we can change at most K bits in both the numbers to make OR of them equal to… Read More »

March 30, 2017

Given an fraction decimal number n and integer k, convert decimal number n into equivalent binary number up-to k precision after decimal point. Input: n… Read More »

March 26, 2017

Given a integer ‘x’, find the number of values of ‘a’ satisfying the following conditions: a XOR x > x 0 < a < x… Read More »

March 24, 2017

Give an integer n. We can flip exactly one bit. Write code to find the length of the longest sequence of 1 s you could… Read More »

March 23, 2017

These are three important builtin functions in GCC compiler: _builtin_popcount(x): This function is used to count the number of one’s(set bits) in an integer. Example:… Read More »

March 12, 2017

Given an array of size n and integer k, count all pairs in array which differ in exactly K bits of binary representation of both… Read More »

March 1, 2017

Implement an space efficient algorithm to determine if a string (of characters from ‘a’ to ‘z’) has all unique characters or not. Use additional data… Read More »

February 28, 2017

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 »

February 22, 2017

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 »

February 20, 2017

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

February 16, 2017

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 »