Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
DSA
22.3k+ articles
Mathematical
7.7k+ articles
Arrays
6.4k+ articles
Strings
3.2k+ articles
Competitive Programming
2.3k+ articles
Algorithms
1.9k+ articles
Bitwise-XOR
430+ articles
Bitwise-AND
130+ articles
setBitCount
110+ articles
Bitwise-OR
110+ articles
DSA
>
Algorithms
>
Bit Magic
Bit Magic
1.2k+ posts
Popular Articles
Recent Articles
Check if a Number is Odd or Even using Bitwise Operators
Last Updated: 20 March 2025
Given a number n, the task is to check whether the number is even or odd using Bitwise Operators.Examples:Input: n = 11Output: OddInput: n =
...read more
Bit Magic
Bitwise-XOR
School Programming
Bitwise-AND
DSA
Reverse actual bits of the given number
Last Updated: 25 March 2025
Given a non-negative integer n, the task is to reverse the bits in its binary representation and return the resulting decimal number. The re
...read more
Bit Magic
Reverse
DSA
Count total bits in a number
Last Updated: 15 July 2022
Given a positive number n, count total bit in it.Examples:Input : 13Output : 4Binary representation of 13 is 1101Input : 183Output : 8Input
...read more
Bit Magic
DSA
Similar Topics
DSA
22.3k+ articles
Mathematical
7.7k+ articles
Arrays
6.4k+ articles
Strings
3.2k+ articles
Competitive Programming
2.3k+ articles
Algorithms
1.9k+ articles
Bitwise-XOR
430+ articles
Bitwise-AND
130+ articles
setBitCount
110+ articles
Bitwise-OR
110+ articles
Determine if a string has all Unique Characters
Last Updated: 10 February 2023
Given a string, determine if the string has all unique characters.Examples :Input : abcd10jkOutput : trueInput : hutg9mnd!nk9Output : falseA
...read more
Strings
Bit Magic
DSA
Convert decimal fraction to binary number
Last Updated: 07 April 2025
Given a fraction decimal number n and integer k, convert decimal number n into equivalent binary number up-to k precision after decimal poin
...read more
Strings
Bit Magic
binary-representation
Fraction
DSA
Highest power of 2 less than or equal to given number
Last Updated: 25 October 2022
Given a number n, find the highest power of 2 that is smaller than or equal to n.Examples :Input : n = 10Output : 8Input : n = 19Output : 16
...read more
Bit Magic
Amazon
Mathematical
Recursion
DSA
XOR of 1 to n Numbers
Last Updated: 14 September 2024
Given a number n, the task is to find the XOR from 1 to n.Examples :Input : n = 6Output : 7// 1 ^ 2 ^ 3 ^ 4 ^ 5 ^ 6 = 7Input : n = 7Output :
...read more
Bit Magic
Mathematical
DSA
Check whether a given number is even or odd
Last Updated: 13 February 2025
Given a number n, check whether it is even or odd. Return true for even and false for odd.Examples:Input: 2 Output: trueInput: 5Output: fals
...read more
Strings
Bit Magic
Sorting
Mathematical
DSA
Kruskal's Minimum Spanning Tree using STL in C++
Last Updated: 27 March 2023
Given an undirected, connected and weighted graph, find Minimum Spanning Tree (MST) of the graph using Kruskal's algorithm.Input : Graph a
...read more
Bit Magic
Graph
STL
MST
union-find
DSA
Swap bits in a given number
Last Updated: 22 April 2025
Given a number x and two positions (0 based from the right side) in the binary representation of x, write a function that swaps n bits at th
...read more
Bit Magic
Bitwise-XOR
DSA
Minimum Bit Flips to convert A to B
Last Updated: 10 April 2025
Given two numbers A and B. Write a program to count the number of bits needed to be flipped to convert A to B.Examples:Input: A = 10, B = 20
...read more
Bit Magic
Amazon
Qualcomm
Samsung
Bitwise-XOR
DSA
Write an Efficient C Program to Reverse Bits of a Number
Last Updated: 28 May 2024
Given an unsigned integer, reverse all bits of it and return the number with reversed bits.Input : n = 1Output : 2147483648 Explanation : On
...read more
Bit Magic
Amazon
Qualcomm
Nvidia
HCL
Mathematical
DSA
Check for Integer Overflow
Last Updated: 26 March 2025
Given two integers a and b. The task is to design a function that adds two integers and detects overflow during the addition. If the sum doe
...read more
Bit Magic
integer-overflow
DSA
Program to find parity
Last Updated: 10 January 2023
Parity: Parity of a number refers to whether it contains an odd or even number of 1-bits. The number has "odd parity" if it contains an odd
...read more
Bit Magic
Mathematical
cryptography
DSA
Write an Efficient Method to Check if a Number is Multiple of 3
Last Updated: 29 March 2025
Given an integer n, the task is to determine whether n is a multiple of 3 or not.Examples:Input: n = 9Output: YesExplanation: 9 is divisible
...read more
Bit Magic
Microsoft
Amazon
Mathematical
DSA
First
1
2
3
4
5
6
7
8
>>
Last
First
1
2
3
4
5
6
>>
Last
First
1
2
3
4
>>
Last
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 !