## Count pairs in an array such that both elements has equal set bits

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 »

- Count set bits in an integer
- Travelling Salesman Problem | Set 1 (Naive and Dynamic Programming)
- Bitwise Operators in C/C++
- Find the element that appears once
- Josephus problem | Set 1 (A O(n) Solution)
- Bitmasking and Dynamic Programming | Set-2 (TSP)
- Bits manipulation (Important tactics)
- Count total set bits in all numbers from 1 to n
- Program to find whether a no is power of two
- Count number of bits to be flipped to convert A to B
- Left Shift and Right Shift Operators in C/C++
- How to swap two numbers without using a temporary variable?
- Sum of bit differences among all pairs
- Binary representation of a given number
- C++ bitset and its application
- Find two numbers from their sum and XOR
- Closest (or Next) smaller and greater numbers with same number of set bits
- Find the two non-repeating elements in an array of repeating elements
- Length of the Longest Consecutive 1s in Binary Representation
- Write an Efficient C Program to Reverse Bits of a Number
- Find the maximum subarray XOR in a given array
- Generate n-bit Gray Codes
- Bit Tricks for Competitive Programming
- Position of rightmost set bit
- Rotate bits of a number
- Write an Efficient Method to Check if a Number is Multiple of 3
- Find the Number Occurring Odd Number of Times
- Count inversions in an array | Set 3 (Using BIT)
- Add two numbers without using arithmetic operators
- Bitwise right shift operators in Java

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 »

Given an array of integers. The task is to replace every element by the bitwise xor of all other elements of the array. Examples: Input:… Read More »

Given a binary matrix. The task is to flip the matrix horizontally(find the image of the matrix), then invert it. Note: To flip a matrix… Read More »

Given a number N, the task is to check if xor value of the frequency of the digits is zero or not. Examples: Input: N… Read More »

Given two integers x and n, the task is to search for the first consecutive stream of 1s (in the x’s 32-bit binary representation) which… Read More »

Given an array of integers, replace every element with xor of previous and next elements with following exceptions. a) First element is replaced by sum… Read More »

Given an array of n elements. The task is to print the maximum sum by selecting two subsequences of the array (not necessarily different) such… Read More »

Given an array of integers and a number . The task is to sort only those elements of the array whose total set bits are… Read More »

Suppose a variable x can have only two possible values a and b, and you wish to assign to x the value other than its… Read More »

Given an integer n, output the no. of leading zeros in it’s binary form. A leading zero is any 0 digit that comes before the… Read More »

Given an unsigned integer x. Round it up to the next greater multiple of 8 using bitwise operations only. Examples: Input : 35 Output :… Read More »

Given an unsigned integer x. Round it down to the next smaller multiple of 8 using bitwise operations only. Examples: Input : 35 Output :… Read More »

We have an integer N. We need to express N as a sum of K integers such that by adding some(or all) of these integers… Read More »

Given two Integer numbers x and y. Compare and print which one of them has more leading zeros using Bitwise operation. If both the no.… Read More »

Given an array arr[] containing N numbers. The task is to check whether the bitwise-OR of the given N numbers is even or odd. Examples:… Read More »