# Tag Archives: math

## Find smallest number K such that K % p = 0 and q % K = 0

Given two integers p and q, the task is to find the smallest number K such that K % p = 0 and q %… Read More »

## Count possible moves in the given direction in a grid

Given a grid N x M size and initial position (X, Y) and a series of K moves. Each move contains 2 integers Dx and… Read More »

## Find the Nth term of the series where each term f[i] = f[i – 1] – f[i – 2]

Given three integers X, Y and N, the task is to find the Nth term of the series f[i] = f[i – 1] – f[i… Read More »

## Find the number of solutions to the given equation

Given three integers A, B and C, the task is to find the count of values of X such that the following condition is satisfied,… Read More »

## Split an array into groups of 3 such that X3 is divisible by X2 and X2 is divisible by X1

Given an array A containing N elements (N is divisible by 3), the task is to split the numbers into groups of 3, let the… Read More »

## Check if an array of 1s and 2s can be divided into 2 parts with equal sum

Given an array containing N elements, each element is either 1 or 2. The task is to find out whether the array can be divided… Read More »

## Find the values of X and Y in the Given Equations

Given two numbers and . Find the values of X and Y in the equations. A = X + Y B = X xor Y… Read More »

## Count triplet pairs (A, B, C) of points in 2-D space that satisfy the given condition

Given N points in 2 dimensional space. The task is to count the number of triplets pairs (A, B, C) such that point B is… Read More »

## Maximize the value of A by replacing some of its digits with digits of B

Given two string A and B which represents two integers, the task is to print the maximized value of A after replacing 0 or more… Read More »

## Count the number of common divisors of the given strings

Given two strings a and b, the task is to count the number of common divisors of both the strings. A string s is a… Read More »

## Maximum sum after repeatedly dividing N by a divisor

Given an integer N. The task is to find the maximum possible sum of intermediate values (Including N and 1) attained after applying the beow… Read More »

## Make all elements of an array equal with the given operation

Given an array arr[] of n integers and an integer k. The task is to make all the elements of arr[] equal with the given… Read More »

## Check if a number can be represented as a sum of 2 triangular numbers

Given an integer N, the task is to find out whether it can be written as a sum of 2 triangular numbers (which may or… Read More »

## Maximize the value of x + y + z such that ax + by + cz = n

Given integers n, a, b and c, the task is to find the maximum value of x + y + z such that ax +… Read More »

## Absolute difference between the first X and last X Digits of N

Given two integers N and X. The task is to print the absolute difference between the first X and last X digits in N. Considering… Read More »