# Category Archives: Bit Magic

Given two positive integer numbers L and R. The task is to convert all the numbers from L to R to binary number. The length… Read More
Given two positive integer numbers L and R. The task is to convert all the numbers from L to R to binary number.  Examples: Input:… Read More
N-Base modified Binary Search is an algorithm based on number bases that can be used to find an element in a sorted array arr[]. This… Read More
Given N numbers with no duplicates, count the number of unique triplets (ai, aj, ak) such that their XOR is 0. A triplet is said… Read More
Given N numbers with no duplicates, count the number of unique triplets (ai, aj, ak) such that their XOR is 0. A triplet is said… Read More
Given N numbers with no duplicates, count the number of unique triplets (ai, aj, ak) such that their XOR is 0. A triplet is said… Read More
Given N numbers with no duplicates, count the number of unique triplets (ai, aj, ak) such that their XOR is 0. A triplet is said… Read More
Given an array arr[] of odd length N containing positive integers. The task is to find a positive integer X such that, adding X to… Read More
Given two positive integers x and y, check if one integer is obtained by rotating bits of other. Input constraint: 0 < x, y <… Read More
Given two positive integers x and y (0 < x, y < 2^32), check if one integer is obtained by rotating bits of the other. … Read More
Given a binary string str, the task is to find its equivalent ASCII character string. Examples:  Input: str = “0110000101100010”Output: abExplanation: Dividing str into set of 8… Read More
Given an array arr[] containing N integers and an array queries[] containing Q queries in the form of {L, R}, the task is to count… Read More
Given an array arr, the task is to count the total number of set bits in all numbers of that array arr. Example: Input: arr[]… Read More
Pre-requisite:Bitwise Operators in C/ C++Bitwise Operators in Java The bitwise complement operator is a unary operator (works on only one operand). It takes one number… Read More
Given a number N, the task is to convert it into a number in which all distinct digits have the same frequency, by rotating its… Read More