# Category Archives: Mathematical

## Count numbers from given range having odd digits at odd places and even digits at even places

Given two integers L and R, the task is to count numbers from the range [L, R] having odd digits at odd positions and even… Read More »

## Split array into equal length subsets with maximum sum of Kth largest element of each subset

Given an array arr[] of size N, two positive integers M and K, the task is to partition the array into M equal length subsets… Read More »

## Split squares of first N natural numbers into two sets with minimum absolute difference of their sums

Given an integer N, the task is to partition the squares of first N( always a multiple of 8 ) natural numbers into two sets… Read More »

## Modify sequence of first N natural numbers to a given array by replacing pairs with their GCD

Given an integer N and an array arr[], the task is to check if a sequence of first N natural numbers, i.e. {1, 2, 3,… Read More »

## Minimum subarray reversals required to make given binary array alternating

Given a binary array arr[] consisting of equal count of 0s and 1s, the task is to count the minimum number of subarray reversal operations… Read More »

## Minimize given flips required to reduce N to 0

Given an integer N, the task is to reduce the value of N to 0 by performing the following operations minimum number of times: Flip… Read More »

## Farthest index that can be reached from the Kth index of given array by given operations

Given an array arr[] consisting of N integers and three integers X, Y, and K, the task is to find the farthest index that can… Read More »

## Modify given array by reducing each element by its next smaller element

Given an array arr[] of length N, the task is to modify the given array by replacing each element of the given array by its… Read More »

## Remove characters from given string whose frequencies are a Prime Number

Given string str of length N, the task is to remove all the characters from the string whose frequencies are prime. Examples: Input: str =… Read More »

## Construct an array of first N natural numbers such that every adjacent pair is coprime

Given a positive integer N, the task is to construct an array consisting of first N natural numbers such that each pair of adjacent elements… Read More »

## Modify N by adding its smallest positive divisor exactly K times

Given two positive integers N and K, the task is to find the value of N after incrementing the value of N in each operation… Read More »

## Program to find the Nth natural number with exactly two bits set | Set 2

Given an integer N, the task is to find the Nth natural number with exactly two set bits. Examples: Input: N = 4Output: 9Explanation: Numbers… Read More »

## Print all possible K-length subsequences of first N natural numbers with sum N

Given two positive integers N and K, the task is to print all possible K-length subsequences from first N natural numbers whose sum of elements… Read More »

## Count ways to make Bitwise XOR of odd and even indexed elements equal by removing an array element

Given an array arr[] of length N, the task is to find the count of array indices such that removing an element from these indices… Read More »

## Count ways to make sum of odd and even indexed elements equal by removing an array element

Given an array, arr[] of size N, the task is to find the count of array indices such that removing an element from these indices… Read More »