# Natural Numbers

### Find all numbers in range [1, N] that are not present in given Array

Given an array arr[] of size N, where arr[i] is natural numbers less than or equal to N, the task…

### Modify array to a permutation of consecutive numbers of longest length by at most K insertions

Given an array arr[] of length N and an integer K, the task is to find the maximize the length…

### Print all numbers that are divisors of N and are co-prime with the quotient of their division

Print all numbers that are divisors of N and are co-prime with the quotient of their divisionGiven a positive integer…

### Generate a permutation of first N natural numbers from an array of differences between adjacent elements

Generate a permutation of first N natural numbers from an array of differences between adjacent elementsGiven an array arr[] consisting…

### Minimize sum of numbers required to convert an array into a permutation of first N natural numbers

Minimize sum of numbers required to convert an array into a permutation of first N natural numbersGiven an array A[] of…

### Sort a permutation of first N Natural Numbers by swapping pairs satisfying given conditions

def Swap(x, y, p, posOfCurrNum):         posOfCurrNum[p[x]], posOfCurrNum[p[y]] = posOfCurrNum[p[y]], posOfCurrNum[p[x]]    p[x], p[y] = p[y], p[x]    return p, posOfCurrNumdef sortArray(p, n):                 posOfCurrNum =  *…

### Count inversions in a permutation of first N natural numbers

Count inversions in a permutation of first N natural numbersGiven an array, arr[] of size N denoting a permutation of…

### Generate a permutation of first N natural numbers having count of unique adjacent differences equal to K

Generate a permutation of first N natural numbers having count of unique adjacent differences equal to KGiven two positive integers…