## Count set bits in an integer using Lookup Table

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

- Find XOR of all elements in an Array
- Count of subarrays of an Array having all unique digits
- Check if a Number is Odd or Even using Bitwise Operators
- Bitwise AND of all the elements of array
- Count number of binary strings without consecutive 1’s : Set 2
- Program to find the Nth natural number with exactly two bits set
- XOR of every element of an Array with a given number K
- Partition of a set into K subsets with equal sum using BitMask and DP
- XOR of elements in a given range with updates using Fenwick Tree
- Bitwise XOR of a Binary array
- Count maximum occurrence of subsequence in string such that indices in subsequence is in A.P.
- Find a Mother vertex in a Graph using Bit Masking
- Count of pairs whose bitwise AND is a power of 2
- Check if left and right shift of any string results into given string
- Count subarrays with sum equal to its XOR value
- Number of subsets with same AND, OR and XOR values in an Array
- Maximum number of set bits count in a K-size substring of a Binary String
- Largest number in the Array having frequency same as value
- Find the largest number smaller than integer N with maximum number of set bits
- Count of binary strings of length N having equal count of 0's and 1's
- Find a number such that maximum in array is minimum possible after XOR
- XOR of pairwise sum of every unordered pairs in an array
- Count of subarrays of size K with elements having even frequencies
- Bitwise operations on Subarrays of size K
- Remove all even parity nodes from a Doubly and Circular Singly Linked List
- Maximum weighted edge in path between two nodes in an N-ary tree using binary lifting
- Sum of bit differences for numbers from 0 to N
- Find the remainder when N is divided by 4 using Bitwise AND operator
- Turn off the rightmost set bit | Set 2
- Find the length of the Largest subset such that all elements are Pairwise Coprime

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 a number, the task is to set all even bit of a number. Positions of bits are counted from LSB (least significant bit) to… Read More »

Given an array of n integers, find the sum of xor of all pairs of numbers in the array. Examples : Input : arr[] =… Read More »

Given a number n, find out number of Reflexive Relation on a set of first n natural numbers {1, 2, ..n}. Examples : Input :… Read More »

Given a number, the task is to set all odd bits of a number. Positions of bits are counted from LSB (least significant bit) to… Read More »

Given two numbers, the task is to use alternative bits within two numbers to create result. We take first bits of second number, then second… Read More »

The problem is to check whether the decimal representation of the given binary number is divisible by 20 or not. Take care, the number could… Read More »

Given two integer numbers, whenever the bits of the first number is set i.e. 1, toggle the bits of the second number leaving the rest… Read More »

Given a positive integer n. The problem is to print numbers in the range 1 to n having first and last bits as the only… Read More »

Given a number, the task is to toggle bits of the number except the first and the last bit. Examples: Input : 10 Output :… Read More »

Given four positive integers, determine if there’s a rectangle such that the lengths of its sides are a, b, c and d (in any order).… Read More »

Given an array of size N. Find the number of pairs (i, j) such that XOR = 0, and 1 <= i < j <=… Read More »

Given a number, the task is to Toggle all even bit of a number Examples: Input : 10 Output : 0 binary representation 1 0… Read More »

Given a number n, the task is to toggle only first and last bits of a number Examples : Input : 10 Output : 3… Read More »

Given a non-negative integer n. The problem is to check if binary representation of n is palindrome or not. Note that the actual binary representation… Read More »