Lexicographically Smallest Permutation of length N such that for exactly K indices, a[i] > a[i] + 1
Given two integers N and K, the task is to generate a permutation of N numbers (Every number from 1 to N occurs exactly once)… Read More »
Given two integers N and K, the task is to generate a permutation of N numbers (Every number from 1 to N occurs exactly once)… Read More »
Given three integer K, L and R (range [L, R]), the task is to find the minimum number of elements the range must be extended… Read More »
Given three integers N, A and B, the task is to find whether N can be represented as sum of A’s and B’s. Examples: Input:… Read More »
Given three integers N, A and B, the task is to find whether N is divisible by any number that contains only A and B… Read More »
Given an array of N elements, the task is to convert it into a permutation (Each number from 1 to N occurs exactly once) by… Read More »
Given a string ( containing characters from ‘0’ to ‘9’) and two digits and . The task is to find the substring in the given… Read More »
Given two integers N and M, partition N into M integers such that the difference between the maximum and minimum integer obtained by the partition… Read More »
Given four integers sourceX, sourceY, destinationX and destinationY which represent the source and destination coordinates on a chessboard. The task is to find the minimum… Read More »
Given an array of distinct elements, the task is to find the total number of two element pairs from the array whose sum is a… Read More »
Given an even number N. The task is to consider numbers from 1 to N2, split them into N groups of the equal sum. Examples:… Read More »
Given a string str containing only lowercase English alphabets, the task is to find the sum and product of all the prime frequencies of the… Read More »
Given two integers and and an array arr[] every element of which at index is calculated as arr[i] = i * (-1)i. The task is… Read More »
Given an N-ary tree, print the number of leaf nodes in the subtree of every node. Examples: Input: 1 / \ 2 3 / |… Read More »
Given an array of integers. The task is to sort the given array on the basis increasing count of distinct prime factors. Examples: Input :… Read More »
Given integers i, j, k and n where (i, j) is the initial position of the Knight on a n * n chessboard, the task… Read More »