Tutorials
Courses
Go Premium
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
32.1K+ articles
DSA
20.0K+ articles
Misc
7.8K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Greedy
1.4K+ articles
Bit Magic
821+ articles
Bitwise-XOR
443+ articles
binary-representation
154+ articles
Bitwise-AND
149+ articles
setBitCount
127+ posts
Recent Articles
Popular Articles
Maximum Strings Concatenation
Last Updated: 23 July 2025
Given an array of strings, where each string consists of lowercase characters from a to j. You need to find the maximum number of strings that can be concatenated together...
read more
Bit Magic
Geeks Premier League
DSA
setBitCount
Bitwise-OR
Geeks Premier League 2023
Largest number less than equal to N having exactly K set bits
Last Updated: 15 October 2023
Given two positive integers N and K, we need to determine if there exists a positive integer X less than or equal to N such that the number of 1s in the binary representat...
read more
Bit Magic
DSA
setBitCount
Bitwise-XOR
Algorithms-Bit Algorithms
Find winner of the game when any set bit is removed in each move
Last Updated: 11 October 2023
Two players, Player 1 and Player 2, are given an integer N to play a game. The rules of the game are as follows :In one turn, a player can remove any set bit of N in its b...
read more
Bit Magic
Technical Scripter
Picked
Technical Scripter 2022
DSA
setBitCount
Introduction to Bitwise Algorithms - Data Structures and Algorithms Tutorial
Last Updated: 23 July 2025
Bit stands for binary digit. A bit is the basic unit of information and can only have one of two possible values that is 0 or 1. In our world, we usually with numbers usin...
read more
DSA
setBitCount
Bitwise-XOR
CPP-bitset
Bit Algorithms
Bitwise-OR
Bitwise-AND
Tutorials
DSA-Blogs
DSA Tutorials
Maximize bitwise AND of Array by changing at most K bits of elements
Last Updated: 01 November 2022
Given an array arr[] of length N. You can perform at most K operations on the array of the following type:Choose an index i (0 ? i ? N-1) and set the j-th bit of arr[i] to...
read more
Bit Magic
Greedy
DSA
Arrays
setBitCount
Bitwise-AND
Check if even and odd count of elements can be made equal in Array
Last Updated: 05 August 2022
Given an array Arr[] of N integers and an integer K, the task is to find if it is possible to make the count of even and odd elements equal by performing the following ope...
read more
Bit Magic
DSA
Arrays
setBitCount
Find all subarray index ranges in given Array with set bit sum equal to X
Last Updated: 23 July 2025
Given an array arr (1-based indexing) of length N and an integer X, the task is to find and print all index ranges having a set bit sum equal to X in the array.Examples:In...
read more
Bit Magic
Greedy
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
setBitCount
subarray
two-pointer-algorithm
Find the level with maximum setbit count in given Binary Tree
Last Updated: 23 July 2025
Given a binary tree having N nodes, the task is to find the level having the maximum number of setbits.Note: If two levels have same number of setbits print the one which ...
read more
Bit Magic
Tree
Searching
Mathematical
Geeks Premier League
Geeks-Premier-League-2022
DSA
setBitCount
Binary Tree
tree-level-order
C program to set K-th bit of a number N
Last Updated: 27 January 2023
Given a number N and an integer K, the task is to set the Kth bit of the number N, i.e., if the Kth bit is 0, then set it to 1 and if it is 1 then leave it unchanged.Examp...
read more
Bit Magic
Mathematical
C Programs
DSA
setBitCount
Bitwise-OR
Minimum operations to set given coordinates as 1 by choosing a set bit index and changing whole row to 1
Last Updated: 22 February 2022
Given a binary matrix arr[][] having N rows and M columns, the task is to calculate the minimum number of operations required to set the value of the coordinate (x, y) as ...
read more
Greedy
Matrix
DSA
setBitCount
binary-representation
Find the index at which bit must be set to maximise distance between next set bit
Last Updated: 06 September 2022
Given a binary array arr[]. The task is to find the position of any 0 in arr[] such that the distance between two set bits is maximized.ExamplesInput: arr = [1, 0, 0, 0, 1...
read more
Misc
Greedy
Mathematical
DSA
Arrays
setBitCount
binary-string
Count of setbits in bitwise OR of all K length substrings of given Binary String
Last Updated: 23 July 2025
Given a binary string str of length N, the task is to find the number of setbits in the bitwise OR of all the K length substrings of string str.Examples:Input: N = 4, K = ...
read more
DSA
setBitCount
binary-string
sliding-window
Bitwise-OR
Find sum of XNOR of all unordered pairs from given Array
Last Updated: 23 July 2025
Given an array arr[] of size N, the task is to find the sum of all XNOR values of all possible unordered pairs from the given array.Examples:Input: N = 5, arr[] = {2, 2, 2...
read more
DSA
setBitCount
binary-representation
Count of Binary Strings of length at most N with set bit count as multiple of K
Last Updated: 23 July 2025
Given two integers N and K, the task is to find the count of binary strings of at most N length that can be formed such that the count of consecutive 1's is always a multi...
read more
Strings
Bit Magic
Dynamic Programming
Combinatorial
DSA
setBitCount
binary-string
Convert 0 to N by adding 1 or multiplying by 2 in minimum steps
Last Updated: 23 July 2025
Given a positive integer N, the task is to find the minimum number of addition operations required to convert the number 0 to N such that in each operation any number can ...
read more
Bit Magic
Mathematical
Combinatorial
TrueGeek
TrueGeek-2021
DSA
setBitCount
1
2
3
4
5
6
7
8
9
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 !