## Square root of a number by Repeated Subtraction method

Given an integer N, the task is to find its perfect square root by repeated subtraction only. Examples: Input: N = 25 Output: 5 Input:… Read More »

- Minimum number of swaps required to sort an array of first N number
- Longest permutation subsequence in a given array
- Sort an Array which contain 1 to N values in O(N) using Cycle Sort
- Average of Cubes of first N natural numbers
- Sort permutation of N natural numbers using triple cyclic right swaps
- Minimum steps to convert an Array into permutation of numbers from 1 to N
- Count of triplets of numbers 1 to N such that middle element is always largest
- Print the two possible permutations from a given sequence
- Count of pairs upto N such whose LCM is not equal to their product for Q queries
- Split N natural numbers into two sets having GCD of their sums greater than 1
- Find all divisors of first N natural numbers
- Length of Smallest subarray in range 1 to N with sum greater than a given value
- Sum of all Perfect numbers lying in the range [L, R]
- Program to print numbers from N to 1 in reverse order
- Count of pairs in a given range with sum of their product and sum equal to their concatenated number
- Count of ways to write N as a sum of three numbers
- Count possible combinations of pairs with adjacent elements from first N numbers
- Minimum value of K such that sum of cubes of first K natural number is greater than equal to N
- Count of digits after concatenation of first N positive integers
- Construct an Array of size N whose sum of cube of all elements is a perfect square
- Find the K-th Permutation Sequence of first N natural numbers
- Fill the missing numbers in the array of N natural numbers such that arr[i] not equal to i
- Print all distinct Coprime sets possible from 1 to N
- Cumulative product of digits of all numbers in the given range
- Print N numbers such that their product is a Perfect Cube
- Find the next Factorial greater than N
- Generate all numbers up to N in Lexicographical Order
- Compositorial of a number
- Product of all Subsets of a set formed by first N natural numbers
- Check if given permutation of 1 to N is feasible using given operations

Given an integer N, the task is to find its perfect square root by repeated subtraction only. Examples: Input: N = 25 Output: 5 Input:… Read More »

Given three integers N, L, and R. The task is to calculate the number of natural numbers in the range [L, R] (both inclusive) which… Read More »

Given a positive integer N, the task is to find the sum of divisors of all the numbers from 1 to N. Examples: Input: N… Read More »

Given two integer N and K, the task is to find the number of sequence of length K consisting of values from the range [1,… Read More »

Given two permutations P1 and P2 of numbers from 1 to N, the task is to find the maximum count of corresponding same elements in… Read More »

Given a natural number N, the task is to find the sum of the series up to Nth term where the ith term denotes the… Read More »

Given a permutation P of size N, having values from 1 to N. the task is to find the minimum number of adjacent swaps required… Read More »

Given an integer K and an index array arr[] of length N which contains elements in the range [1, N], the task is to find… Read More »

Given an integer N, the task is to print all numbers up to N in Lexicographical order. Examples: Input: N = 15 Output: 1 10… Read More »

Given a positive integer N, the task is to find the average of cubes of first N natural numbers. Examples: Input: N = 2 Output: 4.5 Explanation: For integer… Read More »

Given two numbers A and B, the task is to find the count of pairs (X, Y) in range [A, B], such that (X *… Read More »

Given an array arr[] of size N which contains the permutations of the N natural numbers, the task is to sort the permutations of N… Read More »

Given a natural number N, the task is to find the Nth compositorial number. Compositorial of a number refers to the product of all the… Read More »

Given a positive integer N, the task is to find the total number of digits in the concatenation of the first N positive integers. Examples:… Read More »

Given an integer N, the task is to count the number of ways to arrange triplets (a, b, c) within [1, N] in such a… Read More »