Print a number as string of ‘A’ and ‘B’ in lexicographic order
Given a number N, the task is to print the string of ‘A’ and ‘B’ corresponding to that number.If we represent all numbers as a string of ‘A’ and ‘B’ as follows,...
read more
Lexicographically smallest string formed by reversing Substrings of string S exactly K times
Given a string S and an integer K, the task is to find the lexicographically smallest string possible after reversing any substring of any length exactly K times....
read more
Lexicographically smallest string possible by inserting given character
Given a string S and a character C, the task is to place a character in the string in such a way that the string obtained is the lexicographically smallest string....
read more
Sort the words in lexicographical order in Python
Given a strings, we need to sort the words in lexicographical order (dictionary order). Examples :...
read more
Reorder the position of the words in alphabetical order
Given an array arr[] of strings, the task is to reorder the strings lexicographically and print their positions in the original list....
read more
Lexicographically smallest K-length substring containing maximum number of vowels
Given string str containing only the lowercase English alphabet and an integer K, the task is to find a K length substring that contains the maximum number of vowels (i.e. ‘a’, ‘e’, ‘i’, ‘o’, ‘u’). If there are multiple such substrings, return the substring which is lexicographically smallest....
read more
Lexicographically smallest permutation number up to K having given array as a subsequence
Given an integer K and an array arr[] having N pairwise distinct integers in the range [1, K], the task is to find the lexicographically smallest permutation of the first K positive integers such that the given array arr[] is a subsequence of the permutation....
read more
K-th lexicographical string of given length
Given two integers N and K, the task is to find lexicographically Kth string of length N. If the number of possible strings of length N is less than K, print -1.Examples:...
read more
Print all permutations in sorted (lexicographic) order
Given a string, print all permutations of it in sorted order. For example, if the input string is “ABC”, then output should be “ABC, ACB, BAC, BCA, CAB, CBA”....
read more
Python3 Program to Find Lexicographically smallest rotated sequence | Set 2
Write code to find lexicographic minimum in a circular array, e.g. for the array BCABDADAB, the lexicographic minimum is ABBCABDADInput Constraint: 1 < n < 1000 Examples:...
read more
Lexicographically largest possible String after removal of K characters
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 characters from the given string....
read more
Lexicographically smaller string by swapping at most one character pair
Given two strings A and B of all uppercase letters, the task is to find whether is it possible to make string A strictly lexicographically smaller than string B by swapping at most one pair of characters in A.Examples:...
read more