## Count Set-bits of number using Recursion

Given a number N. The task is to find the number of set bits in its binary representation using recursion. Examples: Input : 21 Output… Read More »

- Count total set bits in all numbers from 1 to n | Set 2
- Number formed by the rightmost set bit in N
- Count pairs with set bits sum equal to K
- Find a number containing N - 1 set bits at even positions from the right
- Sort an array according to count of set bits | Set 2
- Find the node whose sum with X has minimum set bits
- Count Set-bits of number using Recursion
- Total character pairs from two strings, with equal number of set bits in their ascii value
- Find the node whose sum with X has maximum set bits
- Count pairs of elements such that number of set bits in their OR is B[i]
- Smallest number greater or equals to N such that it has no odd positioned bit set

Given a number N. The task is to find the number of set bits in its binary representation using recursion. Examples: Input : 21 Output… Read More »

Given a positive integer N, the task is to count the sum of the number of set bits in the binary representation of all the… Read More »

Given an integer N, the task is to find an integer M formed by taking the rightmost set bit in N i.e. the only set… Read More »

Given an integer N, the task is to find the smallest integer X such that it has no odd position set and X ≥ N.… Read More »

Given a positive integer N, the task is to find a number which contains (N – 1) set bits in its binary form at every… Read More »

Given an array arr[] and an integer K, the task is to count the pairs whose sum of set bits is K Examples: Input: arr[]… Read More »

Given two arrays A[] and B[] of N elements each. The task is to find the number of index pairs (i, j) such that i… Read More »

Given a tree, and the weights of all the nodes and an integer x, the task is to find a node i such that weight[i]… Read More »

Given an array arr[] of positive integers, the task is to sort the array in decreasing order of count of set bits in binary representations… Read More »

Given two strings s1 and s2. The task is to take one character from first string and one character from second string and check if… Read More »

Given a positive integer . Find the number of steps required to minimize it to 1. In a single step N either got reduced to… Read More »

Given an integer . The task is to find the number of bits changed after adding 1 to the given number. Examples: Input : N… Read More »

Given an array of integers and a number K. The task is to find the XOR of only those elements of the array whose total… Read More »

Given an array arr with unique elements, the task is to count the total number of pairs of elements that have equal set bits count.… Read More »