Skip to content

Category Archives: Bit Magic

Given two non-negative integers N and K, the task is to invert the Kth most significant bit of N and print the number obtained after… Read More
Given an integer N, the task is to find the greatest number that can be obtained by flipping at most K bits in the binary… Read More
Given an integer N and an infinite number of Full Binary Trees of different depths, the task is to choose minimum number of trees such… Read More
Two players are playing a series of games of Rock–paper–scissors. There are a total of N games played represented by an array arr[][] where arr[i][0]… Read More
Given two integer N and K, the task is to find the value of N XOR N XOR N XOR N … XOR N (K… Read More
Given a graph with N nodes and M edges where each edge has a color (either black or green) and a cost associated with it.… Read More
Given an array of size N containing numbers only from 0 to 63, and you are asked Q queries regarding it.Queries are as follows:   1… Read More
Given a number N in decimal format, the task is to convert it to the hexadecimal representation of N as a string. Negative numbers are… Read More
Given two integers A and B, the task is to find an integer X such that (X XOR A) is minimum possible and the count… Read More
Given a number N, the task is to set, clear and toggle the K-th bit of this number N. Setting a bit means that if… Read More
Given two arrays A[] and B[]. The second array B[] contains all the elements of A[] except for 1 extra element. The task is to… Read More
Given an array arr[] of N elements, the task is to find the maximum number of consecutive 1’s in the binary representation of an element… Read More
Given an octal number N, the task is to convert the number to decimal and then find the modulo with every power of 2 i.e.… Read More
Given an integer array arr1 and a binary array arr2 of same size, the task is to find the maximum possible sum of products of… Read More
Given a range [L, R], the task is to find a pair (X, Y) such that L ≤ X, Y ≤ R and (X |… Read More

Start Your Coding Journey Now!