# Category Archives: Mathematical

## Count of subarrays of size K which is a permutation of numbers from 1 to K

Given an array arr of distinct integers, the task is to find count of sub-arrays of size i having all elements from 1 to i,… Read More »

## Print all permutations of a number N greater than itself

Given a number N, our task is to print those permutations of integer N which are greater than N. Examples: Input: N = 534 Output:… Read More »

## Create an array such that XOR of subarrays of length K is X

Given three integers N, K and X, the task is to construct an array of length N, in which XOR of all elements of each… Read More »

## Find the K closest points to origin using Priority Queue

Given a list of n points on 2D plane, the task is to find the K (k < n) closest points to the origin O(0,… Read More »

## Split the number N by maximizing the count of subparts divisible by K

Given a numeric string N and an integer K, the task is to split digits of N into subparts such that the number of segments… Read More »

## Count subarrays with sum equal to its XOR value

Given an array arr[] containing N elements, the task is to count the number of sub-arrays whose XOR of all the elements is equal to… Read More »

## Count of subarrays which contains a given number exactly K times

Given an array A[] of N elements consisting of values from 1 to N with duplicates, the task is to find the total number of… Read More »

## Angle between a Pair of Lines in 3D

Given coordinates of three points A(x1, y1, z1), B(x2, y2, z2) and C(x3, y3, z3) in a 3D plane, where B is the intersection point… Read More »

## Count of pairs in an Array whose sum is Prime

Given an array arr of size N elements, the task is to count the number of pairs of elements in the array whose sum is… Read More »

## Minimum side of square embedded in Regular polygon with N sides

Given an even number N which represents the number of sides of a regular polygon with N vertices, the task is to find the square… Read More »

## Count of subsequences of length atmost K containing distinct prime elements

Given an array arr of length N and an integer K, the task is to count the number of possible subsequences of length at most… Read More »

## Construct an Array such that cube sum of all element is a perfect square

Given the size of array N, the task is to construct an array of size N with positive integer elements such that the cube sum… Read More »

## Smallest number possible by swapping adjacent even odd pairs

Given a numeric string str, the task is to find the smallest integer that can be formed by swapping adjacent digits of distinct parity. Examples:… Read More »

## BCD addition of given Decimal numbers

Given two numnbers A and B, the task is to perform BCD Addition of the given numbers. Examples: Input: A = 12, B = 20… Read More »

## Program to find the indefinite Integration of the given Polynomial

Given a polynomial string str, the task is to integrate the given string and print the string after integrating it. Note: The input format is… Read More »