Count set bits in an integer
Write an efficient program to count the number of 1s in the binary representation of an integer.Examples :...
read more
C program to count zeros and ones in binary representation of a number
Given a number N, the task is to write C program to count the number of 0s and 1s in the binary representation of N....
read more
Count total set bits in all numbers from range L to R
Given two positive integers L and R, the task is to count the total number of set bits in the binary representation of all the numbers from L to R....
read more
Minimize sum of incompatibilities of K equal-length subsets made up of unique elements
Given an array arr[] consisting of N integers and an integer K, the task is to find the minimum sum of incompatibilities of K subsets of equal sizes having unique elements....
read more
Queries to calculate Bitwise AND of an array with updates
Given an array arr[] consisting of N positive integers and a 2D array Q[][] consisting of queries of the type {i, val}, the task for each query is to replace arr[i] by val and calculate the Bitwise AND of the modified array....
read more
Sum of Bitwise AND of each array element with the elements of another array
Given two arrays arr1[] of size M and arr2[] of size N, the task is to find the sum of bitwise AND of each element of arr1[] with the elements of the array arr2[]....
read more
Count integers in an Array which are multiples their bits counts
Given an array arr[] of N elements, the task is to count all the elements which are a multiple of their set bits count.Examples:...
read more
Maximum Strings Concatenation
Given an array of strings, where each string consists of lowercase characters from a to j. You need to find the maximum number of strings that can be concatenated together such that the resulting string can be made out of exactly k distinct characters....
read more
Number of pairs whose product is a power of 2
Given an array arr[] consisting of N integers, the task is to count the total number of pairs of array elements from the given array such that arr[i] * arr[j] is the power of 2....
read more
Nth term of Ruler Function Series
Given a positive integer N, the task is to find the Nth term of the Ruler Function Series....
read more
Queries to count array elements from a given range having a single set bit
Given an array arr[] consisting of N integers and a 2D array Q[][] consisting of queries of the following two types:...
read more
Represent N as the sum of exactly K powers of two | Set 3
Given two integers N and K, the task is to find whether it is possible to represent N as the sum of exactly K powers of 2. If possible, then print K positive integers such that they are powers of 2 and their sum is exactly equal to N. Otherwise, print “Impossible”. If multiple answers exist, print any....
read more