Given a base 10 integer N, the task is to find the 1’s complement of this Base 10 Integer. Examples: Input: N = 5Output: 2Explanation:… Read More
Category Archives: Bit Magic
Given a number N, the task is to find the longest range of integers [L, R] such that 1 ≤ L ≤ R ≤ N… Read More
Space complexity is the most underestimated asset by programmers. One can barely see a Memory Limit Exceed (MLE) while submitting a solution. But, saving memory… Read More
Given two integers N and K, The task is to find the count of all possible arrays of size N with maximum sum & bitwise… Read More
Given an integer N, find the one’s complement of the integer. Examples: Input: N = 5Output: 2Explanation: Binary representation of 5 is “101”. Its one’s… Read More
Given an array queries[][] of Q range queries, the task is to find the minimum removals from the range[l, r] such that the bitwise AND… Read More
Given a number N. The task is to count the number of distinct XOR of any possible pairs using numbers from 1 to N inclusive.… Read More
Given a positive integer number N. The task is to generate all the binary numbers of N digits. These binary numbers should be in ascending… 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. 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