## Minimize the number of steps required to reach the end of the array

Given an integer array arr[] of length N consisting of positive integers, the task is to minimize the number of steps required to reach the… Read More »

- Minimum number N such that total set bits of all numbers from 1 to N is at-least X
- Minimize the number of steps required to reach the end of the array
- Print steps to make a number in form of 2^X - 1
- Minimum number of elements that should be removed to make the array good
- Check if matrix A can be converted to B by changing parity of corner elements of any submatrix
- Find the value at kth position in the generated array
- Find a positive number M such that gcd(N^M, N&M) is maximum
- Total distinct pairs from two arrays such that second number can be obtained by inverting bits of first

Given an integer array arr[] of length N consisting of positive integers, the task is to minimize the number of steps required to reach the… Read More »

Given a number N, there are two steps to be performed. At odd step, XOR the number with any 2^M-1, where M is chosen by… Read More »

Given two binary matrices A[][] and B[][] of N X M. In a single operation, one can choose a sub-matrix (min of 2 rows and… Read More »

Given three integer n, m and k. Find the element at kth position after repeating the given operation n number of times. In a single… Read More »

Given two arrays arr1[] and arr2[], the task is to take an element from first array (say a) and one element from second array (say… Read More »

Given an array arr[], the task is to find the minimum number of elements that must be removed to make the array good. A sequence… Read More »

Given a number N, the task is to find a positive number M such that gcd(N^M, N&M) is the maximum possible and M < N.… Read More »

Given a number X, the task is to find the minimum number N such that total set bits of all numbers from 1 to n… Read More »

Given two integers(less than 2^31) A and B. The task is to find the number of bits that are different in their binary representation. Examples:… Read More »

Given a non-negative number and two values and . The problem is to check whether or not N has an alternate pattern in its binary… Read More »

Given two binary strings s1 and s2. The XOR of them is X, the task is to find the number of ways to swap two-bit… Read More »

Given an array of integers arr[]. The task is to find the maximum sum of set bits(of the array elements) without adding the set bits… Read More »

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

Prerequisites: Fenwick Tree (Binary Indexed Tree) Given an array of N numbers, and a number of queries where each query will contain three numbers(l, r… Read More »

Given a number N, the task is to check whether the count of the set and unset bits in the given number are same. Examples:… Read More »