# Category Archives: Mathematical

## Count minimum number of moves to front or end to sort an array

Given an array arr[] of size N, the task is to find the minimum moves to the beginning or end of the array required to… Read More »

## Rearrange array to make it non-decreasing by swapping pairs having GCD equal to minimum array element

Given an array, arr[] consisting of N positive integers, the task is to make the array non-decreasing by swapping pairs (arr[i], arr[j]) such that i… Read More »

## Sum of maximum and minimum of Kth subset ordered by increasing subset sum

Given an integer N and set of all non-negative powers of N as S = {N0, N1, N2, N3, … }, arrange all non-empty subsets… Read More »

## Maximum distinct prime factors of elements in a K-length subarray

Given an array arr[] of N positive integers and an integer K, the task is to find the maximum distinct prime factors in a subarray… Read More »

## Count possible splits of sum N into K integers such that the minimum is at least P

Given three integers N, P, and K, the task is to find the total number of ways to divide N into K integers having sum… Read More »

## Construct an AP series consisting of A and B having minimum possible Nth term

Given two integers A, B which are any two terms of an Arithmetic Progression series, and an integer N, the task is to to construct… Read More »

## Smallest subarray of size greater than K with sum greater than a given value

Given an array, arr[] of size N, two positive integers K and S, the task is to find the length of the smallest subarray of… Read More »

## Minimize count of given operations required to make two given strings permutations of each other

Given two strings str1 and str2, the task is to count the minimum number of operations of the following three types on one of the… Read More »

## Count ordered pairs of numbers with a given LCM

Given an integer N, the task is to count the total number of ordered pairs such that the LCM of each pair is equal to… Read More »

## Paths requiring minimum number of jumps to reach end of array

Given an array arr[], where each element represents the maximum number of steps that can be made forward from that element, the task is to… Read More »

## Length of longest increasing absolute even subsequence

Given an array arr[] consisting of N integers, the task is to find the length of the longest increasing absolute even subsequence. An increasing absolute… Read More »

## Modify given array to make sum of odd and even indexed elements same

Given a binary array arr[] of size N, remove at most N/2 elements from the array such that the sum of elements at odd and… Read More »

## Check if a subarray of length K with sum equal to factorial of a number exists or not

Given an array arr[] of N integers and an integer K, the task is to find a subarray of length K with sum of elements… Read More »

## Counting Rock Samples | TCS Codevita 2020

John is a geologist, and he needs to count rock samples in order to send it to a chemical laboratory. He has a problem. The… Read More »

## Smallest prefix to be deleted such that remaining array can be rearranged to form a sorted array

Given an array arr[] consisting of N integers, the task is to find the minimum length of the prefix needed to be deleted such that… Read More »