## Queries to return the absolute difference between L-th smallest number and the R-th smallest number

Given an array arr[] of N unique elements and Q queries. Every query consists of two integers L and R. The task is to print… Read More »

## Largest number N which can be reduced to 0 in K steps

Given an integer N. The following tasks are performed: The number is noted. The leading digit from N is subtracted from N and the resulting… Read More »

## Find 2^(2^A) % B

Given two integers A and B, the task is to calculate 22A % B. Examples: Input: A = 3, B = 5 Output: 1 223… Read More »

## Smallest index in the given array that satisfies the given condition

Given an array arr[] of size N and an integer K, the task is to find the smallest index in the array such that: floor(arr[i]… Read More »

## Find the value of XXXX…..(N times) % M where N is large

Given three integers X, N and M. The task is to find XXX…(N times) % M where X can be any digitfrom the range [1,… Read More »

## Find the smallest number X such that X! contains at least Y trailing zeros.

Given an integer Y, find the smallest number X such that X! contains at least Y trailing zeros. Prerequisites – Count trailing zeroes in factorial… Read More »

## Find the number of ways to divide number into four parts such that a = c and b = d

Given a number N. Find the number of ways to divide a number into four parts(a, b, c, d) such that a = c and… Read More »

## Find a distinct pair (x, y) in given range such that x divides y

Given a range of positive integers from l to r. Find such a pair of integers (x, y) that l <= x, y <= r,… Read More »

## Count integers in a range which are divisible by their euler totient value

Given 2 integers L and R, the task is to find out the number of integers in the range [L, R] such that they are… Read More »

## Minimum steps to make all the elements of the array divisible by 4

Given an array of size n, the task is to find the minimum number of steps required to make all the elements of the array… Read More »

## Check if matrix can be converted to another matrix by transposing square sub-matrices

Given two N X M matrices of integers. In an operation, we can transpose any square sub-matrix in matrix1. The task is to check if… Read More »

## Count how many times the given digital clock shows identical digits

Given a generic digital clock, having h number of hours and m number of minutes, the task is to find how many times the clock… Read More »

## Check if a Queen can attack a given cell on chessboard

Given the position of the queen (qX, qY) and the opponent (oX, oY) on a chessboard. The task is to determine whether the queen can… Read More »

## Find d to maximize the number of zeros in array c[] created as c[i] = d*a[i] + b[i]

Given two arrays of N integers. Consider an array C, where the i-th integer will be d*a[i] + b[i] where d is any arbitrary real… Read More »

## Maximize the number of sum pairs which are divisible by K

Given an array of N integers and an integer K. The task is to print the maximum number of pairs(a[i]+a[j]) possible which are divisible by… Read More »