Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
Misc
8.8K+ articles
Mathematical
7.8K+ articles
Arrays
6.5K+ articles
Competitive Programming
3.3K+ articles
Strings
3.3K+ articles
Greedy
2.1K+ articles
Algorithms
2.0K+ articles
Sorting
1.8K+ articles
Searching
1.7K+ articles
DSA
/
Algorithms
/
Bit Magic
Bit Magic
1.2K+ posts
Recent Articles
Popular Articles
Find the MEX of given XOR sequence
Last Updated: 23 March 2024
Given two integers N and M. The task is to determine the MEX (Minimal Excluded) of the following sequence: N ^ 0, N ^ 1, N ^ 2... N ^ M, where ^ is the Bitwise XOR operato...
read more
Bit Magic
Competitive Programming
Picked
Geeks Premier League
DSA
Geeks Premier League 2023
MEX (Minimal Excluded)
Queries for Sum of Bitwise AND of all Subarrays in a Range
Last Updated: 11 March 2024
Given an array arr[] of size N, the task is to answer a set of Q queries, each in the format of queries[i][0] and queries[i][1]. For each queries[i], find the sum of Bitwi...
read more
Bit Magic
Geeks Premier League
DSA
Geeks Premier League 2023
Precomputation
CSES Solutions - Missing Number
Last Updated: 11 October 2024
Given an array arr[] of size N - 1 containing numbers between 1, 2... N, except one, the task is to find the missing number.Examples:Input: N = 5, arr[] = {2, 3, 1, 5}Outp...
read more
Bit Magic
Competitive Programming
Picked
DSA
CSES Problems
CSES Solutions - Bit Strings
Last Updated: 27 March 2024
Your task is to calculate the number of bit strings of length N. For example, if N=3, the correct answer is 8, because the possible bit strings are 000, 001, 010, 011, 100...
read more
Bit Magic
Competitive Programming
Picked
DSA
Binary Exponentiation
CSES Problems
CSES Solutions - Counting Bits
Last Updated: 04 April 2024
Given an integer N (1 ≤ N ≤ 1015), the task is to count the number of one bits in the binary representations of integers between 1 and N.Examples:Input: N = 7Output: 12Exp...
read more
Bit Magic
Competitive Programming
Picked
DSA
CSES Problems
Worker-Bike Assignments (Campus Bikes)
Last Updated: 18 April 2024
Given an array workers[] and bikes[], which represents position of workers and bikes on a 2D plane, the task is to assign each worker to a bike based on the shortest Manha...
read more
Bit Magic
Dynamic Programming
Picked
DSA
Google
Algorithms-Dynamic Programming
Bitwise Algorithm in Python
Last Updated: 18 April 2024
Bitwise algorithms refer to the use of bitwise operators to manipulate individual bits of data. Python provides a set of bitwise operators such as AND (), OR (|), XOR (^),...
read more
Bit Magic
Algorithms
Picked
DSA
Bit Algorithms
Python-DSA
Bitwise Algorithms - Basic Practice Problems
Last Updated: 23 August 2024
Bitwise algorithms are a category of algorithms that operate on individual bits within a data unit, rather than the entire data unit itself. They leverage bitwise operato...
read more
Bit Magic
DSA
Bitwise Algorithms - Intermediate Practice Problems
Last Updated: 23 August 2024
Bitwise operations are fundamental to computer programming and problem-solving. At the intermediate level, you'll explore more complex bitwise algorithms and techniques to...
read more
Bit Magic
DSA
Find the Number Using Bitwise Questions I
Last Updated: 14 June 2024
Given a task to find a number n. There is a pre-defined API int commonSetBits(int val) that returns the number of bits where both n and val have a value of 1 in the corres...
read more
Bit Magic
Picked
DSA
Intuit
Swap Two Numbers
Last Updated: 24 February 2025
Given two numbers a and b, the task is to swap them.Examples: Input: a = 2, b = 3Output: a = 3, b = 2Input: a = 20, b = 0Output: a = 0, b = 20Input: a = 10, b = 10Output: ...
read more
Bit Magic
Mathematical
DSA
Commonly Asked Data Structure Interview Questions on Bit Manipulation
Last Updated: 04 March 2025
Bit manipulation is a powerful technique often used in technical interviews to optimize space and time complexities by directly working with the binary representations of ...
read more
Bit Magic
Data Structures
Data Structures
Top Problems on Bit Manipulation for Interviews
Last Updated: 03 March 2025
This topic focuses on operations involving binary numbers and bitwise operators, which can lead to highly efficient solutions for complex problems. Bit manipulation often ...
read more
Bit Magic
DSA
Total Hamming Distance
Last Updated: 22 April 2025
Given an integer arrayarr[], return the sum ofHamming distancesbetween all the pairs of the integers inarr.The Hamming distance between two integers is the number of bit p...
read more
Bit Magic
DSA
Maximum XOR Queries With an Element From Array
Last Updated: 18 April 2025
Given an array arr[] of size n containing non-negative integers and also given a list of q queries in a 2D array queries[][], where each query is of the form [xi, mi]. For...
read more
Bit Magic
DSA
1
2
3
4
...
81
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !