# Category Archives: Mathematical

## Length of longest subarray of length at least 2 with maximum GCD

Given an array arr[] of length N, the task is the find the length of longest subarray of length at least 2 with maximum possible… Read More »

## Split N powers of 2 into two subsets such that their difference of sum is minimum

Given an even number N, the task is to split all N powers of 2 into two sets such that the difference of their sum… Read More »

## Find integral points with minimum distance from given set of integers using BFS

Given an integer array A[] of length N and an integer K. The task is to find K distinct integral points which are not present… Read More »

## Minimize the non-zero elements in the Array by given operation

Given an array arr[] of length N, the task is to minimize the count of the number of non-zero elements by adding the value of… Read More »

## Count of N digit palindromic numbers divisible by 9

Given an integer N, the task is to count the number of N digit palindromic numbers containing digits from 1 to 9 and divisible by… Read More »

## Count of sub-arrays with odd product

Given an integer array arr[] of size N, the task is to count the number of sub-arrays that have an odd product. Examples: Input :… Read More »

## Calculate the CGPA and CGPA % of marks obtained by a Student in N subjects

Given an array arr[] of size N which contains the marks of a student in N subjects, the task is to calculate the CGPA and… Read More »

## Find the subarray of size K with minimum XOR

Given an array arr[] and integer K, the task is to find the minimum bitwise XOR sum of any subarray of size K in the… Read More »

## Greatest number that can be formed from a pair in a given Array

Given an array arr[], the task is to find the largest number that can be formed from a pair in the given array. Examples: Input:… Read More »

## 0/1 Knapsack Problem to print all possible solutions

Given weights and profits of N items, put these items in a knapsack of capacity W. The task is to print all possible solutions to… Read More »

## Check whether a straight line can be formed using N co-ordinate points

Given an array arr[] of N co-ordinate points, the task is to check wheather a straight line can be formed using these co-ordinate points. Input:… Read More »

## Maximum possible prime divisors that can exist in numbers having exactly N divisors

Given an integer N which denotes the number of divisors of any number, the task is to find the maximum prime divisors that are possible… Read More »

## Check whether two numbers are in golden ratio

Given two numbers A and B, the task is to check that A and B are in golden ratio. Golden Ratio: Two numbers are said… Read More »

## Find two numbers made up of a given digit such that their difference is divisible by N

Given two numbers, N and M, the task is to find two numbers made up of M as all its digits such that their difference… Read More »

## Minimum operations to make all elements equal using the second array

Given two arrays A[] and B[] both having N elements. Find the minimum number of operations to make all elements of A equal to the… Read More »