Given a binary string S of size N and a number K, the task is to find if all the ‘0’s can be changed into… Read More

# Tag Archives: Algorithms-Bit Algorithms

Given a number N, the task is to perform the bitwise operations on digits of the given number N. The bitwise operations include: Finding the… Read More

Given a positive integer N, the task is to find a number which contains (N – 1) set bits in its binary form at every… Read More

Given an integer . The task is to count all such numbers that are less than or equal to N which are divisible by any of… Read More

Given a non-negative integer N. The task is to invert the bits of the number N and print the decimal equivalent of the number obtained… Read More

Given N strings which represents all integers from 0 to N in binary format except any one. The task is to find the missing number.… Read More

Given two numbers a and b. The task is to subtract b from a by using 2’s Complement method.Note: Negative numbers represented as 2’s Complement… Read More

Given two 32-bit numbers, N and M, and two-bit positions, i and j. Write a method to insert M into N such that M starts… Read More

Given an array of N integers and a number X. The task is to find the index of first element which is greater than or… Read More

Given an array of N numbers, the task is to find the maximum sum that can be obtained by adding numbers with the same number… Read More

Given an array of N integers. The task is to find the number of pairs (i, j) such that A[i] & A[j] is odd.Examples: Input:… Read More

Given two non-negative numbers a and b and two values l and r. The problem is to check whether all bits at corresponding positions in… Read More

Given an array arr[0 . . . n-1]. The task is to perform the following operation: Find the maximum of elements from index l to… Read More

Given an array of N integers and an integer M. You can change the sign(positive or negative) of any element in the array. The task… Read More

Given a decimal number m, convert it into a binary string and apply n iterations, in each iteration 0 becomes “01” and 1 becomes “10”.… Read More