## Minimum number of elements that should be removed to make the array good

Given an array arr[], the task is to find the minimum number of elements that must be removed to make the array good. A sequence… Read More »

- Subtraction of two numbers using 2's Complement
- Minimum number N such that total set bits of all numbers from 1 to N is at-least X
- Number of mismatching bits in the binary representation of two integers
- Maximum set bit sum in array without considering adjacent elements
- Minimum number of elements that should be removed to make the array good
- Number of ways to change the XOR of two numbers by swapping the bits
- Check whether bits are in alternate pattern in the given range | Set-2
- Find a positive number M such that gcd(N^M, N&M) is maximum

Given an array arr[], the task is to find the minimum number of elements that must be removed to make the array good. A sequence… Read More »

Given a number N, the task is to find a positive number M such that gcd(N^M, N&M) is the maximum possible and M < N.… Read More »

Given a number X, the task is to find the minimum number N such that total set bits of all numbers from 1 to n… Read More »

Given two integers(less than 2^31) A and B. The task is to find the number of bits that are different in their binary representation. Examples:… Read More »

Given a non-negative number and two values and . The problem is to check whether or not N has an alternate pattern in its binary… Read More »

Given two binary strings s1 and s2. The XOR of them is X, the task is to find the number of ways to swap two-bit… Read More »

Given an array of integers arr[]. The task is to find the maximum sum of set bits(of the array elements) without adding the set bits… Read More »

Given two numbers and . The task is to subtract from by using 2’s Complement method. Note: Negative numbers represented as 2’s Complement of Positive… Read More »

Prerequisites: Fenwick Tree (Binary Indexed Tree) Given an array of N numbers, and a number of queries where each query will contain three numbers(l, r… Read More »

Given a number N, the task is to check whether the count of the set and unset bits in the given number are same. Examples:… Read More »

Given a positive integer n, check whether only the first and last bits are set in the binary representation of n. Print ‘Yes’ or ‘No’.… Read More »

Given an integer N, task is to find the numbers which when raised to the power of 2 and added finally, gives the integer N.… Read More »

Given an array A[] of n integers, find out the number of ordered pairs such that Ai&Aj is zero, where 0<=(i,j)<n. Consider (i, j) and… Read More »

Prerequisite: Basic Dynamic Programming, Bitmasks Consider the following problem where we will use Sum over subset Dynamic Programming to solve it. Given an array of… Read More »

Given a number N, print all the numbers which are a bitwise AND set of the binary representation of N. Bitwise AND set of a… Read More »