## Print steps to make a number in form of 2^X – 1

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 »

## Count of strings whose prefix match with the given string to a given length k

Given an array of strings arr[] and given some queries where each query consists of a string str and an integer k. The task is… Read More »

## Check if string can be made lexicographically smaller by reversing any substring

Given a string S, the task is to check if we can make the string lexicographically smaller by reversing any sub-string of the given string.… Read More »

## Game Theory in Balanced Ternary Numeral System | (Moving 3k steps at a time)

Just like base 2 Binary numeral system having 0s and 1s as digits, Ternary(Trinary) Numeral System is a base 3 number system having 0s, 1s… Read More »

## Highest power of 2 that divides a number represented in binary

Given a binary string str, the task is to find the largest power of 2 that divides the decimal equivalent of the given binary number.… Read More »

## Number of ways to arrange K different objects taking N objects at a time

Given two integers K and N, the task is to count the number of ways to arrange K different objects taking N objects at a… Read More »

## Find the minimum sum of distance to A and B from any integer point in a ring of size N

Given a circular ring which has marking from 1 to N. Given two numbers A and B, you can stand at any place(say X) and… Read More »

## Check if a number from every row can be selected such that xor of the numbers is greater than zero

Given a 2-D array of order N X M array elements, the task is to check if we can select a number from every row… Read More »

## Find the original matrix when largest element in a row and a column are given

Given two arrays A[] and B[] of N and M integers respectively. Also given is a N X M binary matrix where 1 indicates that… Read More »

## Find the maximum possible value of a[i] % a[j] over all pairs of i and j

Given an array arr[] of N positive integers. The task is to find the maximum possible value of a[i] % a[j] over all pairs of… Read More »

## Find the number of divisors of all numbers in the range [1, n]

Given an integer N. The task is to find the number of divisors of all the numbers in the range [1, N]. Examples: Input: N… Read More »

## Find the number of sub arrays in the permutation of first N natural numbers such that their median is M

Given an array arr[] containing the permutation of first N natural numbers and an integer M ≤ N. The task is to find the number… Read More »

## Program to find the maximum difference between the index of any two different numbers

Given an array of N integers. The task is to find the maximum difference between the index of any two different numbers. Note that there… Read More »

## Interactive Problems in Competitive Programming

Interactive Problems are those problems in which our solution or code interacts with the judge in real time. When we develop a solution for an… Read More »

## Find the minimum number of operations required to make all array elements equal

Given an array arr[] of size N. The task is to make all the array elements equal by applying the below operations minimum number of… Read More »