Bit Manipulation
34 problems to practice.
Gray Code
1. The gray code is a binary numeral system where two successive numbers differ in only one bit. 2....
Basics Of Bit Manipulation
1. You are given a number n. 2. Print the number produced on setting its i-th bit. 3. Print the nu...
Print Value Of Rsb Mask
1. You are given a number n. 2. You have to print the right-most set bit mask.
Kernighans Algorithm
1. You are given a number n. 2. You have to count the number of set bits in the given number.
All Repeating Except One
1. You are given an array of numbers. 2. All numbers occur twice in the array except one. 3. You h...
All Repeating Except Two
1. You are given an array of numbers. 2. You have to find 2 non-repeating numbers in an array. 3....
All Repeating Three Times Except One
1. You are given an array of numbers. 2. All numbers occur thrice in the array except one. 3. You...
One Repeating And One Missing
1. You are given an array of length n containing numbers from 1 to n. 2. One number is present twic...
Flip Bits To Convert A To B
1. You are given two numbers A and B. 2. You have to print the count of bits needed to be flipped t...
Copy Set Bits In A Range
1. You are given two numbers A and B. 2. You are given two more numbers left and right, representin...
Check Divisibility By 3
1. You are given a binary string which represents a number. 2. You have to check whether this numbe...
Print Binary And Reverse Bits
1. You are given a number. 2. You have to print its binary representation. 3. You also have to rev...
Count Set Bits In First N Natural Numbers
1. You are given a number n. 2. You have to print the count of set bits of first n natural numbers.
Is A Power Of 2
1. You are given a number n. 2. You have to check whether it is a power of 2 or not.
Solve 7n By 8
1. You are given a number n. 2. You have to calculate the value of 7n/8 without using division and...
Swap All Odd And Even Bits
1. You are given a number n. 2. You have to swap all odd position bits with even position bits. 3....
Sum Of Bit Differences Of All Pairs
1. You are given an array of n numbers. 2. You have to find the sum of bit differences in all pairs...
Josephus Special
1. You are given an integer N which represents the total number of soldiers standing in a circle...
Minimum Number Of Software Developers
1. You are given N strings which represents N different skills related to I.T field. 2. You are wor...
Number Of Valid Words
1. You are given N number of words. 2. You are given M puzzles in the form of M strings. 3. For a...
Triplets - 1
1. You are given an array(arr) of N numbers. 2. You have to select three indices i,j,k following th...
Reduce N To 1
1. You are given a positive number N. 2. You have to find the minimum number of operations required...
Pepcoder And Bits
1. Pepcoder is feeling confident after solving many problems on Bit Manipulation. 2. So, his teache...
Xor Of Sum Of All Pairs
1. You are given an array of integers. 2. You have to find the XOR of sum of all pairs in the array...
Abbreviation 1 - Using Bits
1. You are given a word. 2. You have to generate all abbrevations of that word. Note - Use bit man...
Utf - 8 Encoding
1. You are given an array of integers. 2. You are required to test whether the array represents a v...
Sudoku Using Bit Manipulation
1. You are give a partially filled 9*9 2-D array(arr) which represents an incomplete sudoku state....
N Queens Using Bit
1. You are given a number n, the size of a chess board. 2. You are required to place n number of qu...
Min Xor Pairs
1. You are given an array of distinct integers. 2. You have to print all pairs of integers in the a...
Nth Palindromic Binary
1. You are given an integer N. 2. You have to find the N-th number whose binary representation is a...
Is A Power Of 4
<a href="https://leetcode.com/problems/power-of-four/">https://leetcode.com/problems/power-of-...
Xor Queries Of A Subarray
https://leetcode.com/problems/xor-queries-of-a-subarray/
Minimum Flips To Make A Or B Equal To C
https://leetcode.com/problems/minimum-flips-to-make-a-or-b-equal-to-c/
Find Longest Awesome Substring
<a href="https://leetcode.com/problems/find-longest-awesome-substring/">https://leetcode.com/p...