Skip to content

Tag Archives: lexicographic-ordering

Given a string S consisting of lowercase alphabets, the task is to find the lexicographically smallest string that can be obtained by removing duplicates from… Read More
Given a string S of length N, the task is to find the lexicographically smallest subsequence of length (N – 1), i.e. by removing a… Read More
Given two positive integers, A and B, the task is to generate the lexicographically smallest permutation of all integers up to A in which exactly… Read More
Given string str, the task is to find the rank of the given string among all its substrings arranged lexicographically. Examples: Input: S = “enren”Output:… Read More
Given an array arr[] of N strings and a string order which represents the new alphabetical order of the string. The task is to find… Read More
Given an array of strings arr[] of size N, the task is to sort the array of strings in lexicographical order and if while sorting… Read More
Given a string S consisting of only lowercase letters, the task is to find the lexicographically largest string that can be obtained by removing K… Read More
Given an integer N and an array arr[] of positions which denotes the positions of already placed non-attacking rooks, the task is to find the… Read More
Given string str of size N, which contains lowercase English alphabets. The task is to replace each vowel with the next immediate vowel lexicographically, i.e., … Read More
Given a string S and integer M. The task is to perform exactly M operations to get lexicographical smallest string. In each operation, select one… Read More
Given a string consisting of the first N distinct alphabets, the task is to sort the string by using at most N/2 moves. Each move… Read More
Given a string S, print those permutations of string S which are lexicographically greater than S. If there is no such permutation of string, print… Read More
Given string str of length N, the task is to obtain the lexicographically largest string by at most one swap.  Note: The swapping characters might… Read More
Given two strings S1 and S2 of length N and a positive integer K, the task is to find the lexicographically smallest string such that… Read More

Start Your Coding Journey Now!