## Print all distinct circular strings of length M in lexicographical order

Given a string and an integer M, print all distinct circular strings of length M in lexicographical order. Examples: Input: str = “baaaa”, M =… Read More »

## Lexicographically Kth smallest way to reach given coordinate from origin

Given a coordinate (x, y) on a 2D plane. We have to reach (x, y) from the current position which is at origin i.e (0,… Read More »

## Lexicographical Maximum substring of string

Given a string s we have to find the lexicographical maximum substring of a string Examples: Input : s = “ababaa” Output : babaa Explanation… Read More »

## Lexicographically smallest string obtained after concatenating array

Given n strings, concatenate them in an order that produces the lexicographically smallest possible string. Examples: Input : a[] = [“c”, “cb”, “cba”] Output :… Read More »

## Largest lexicographic array with at-most K consecutive swaps

Given an array arr[], find the lexicographically largest array that can be obtained by performing at-most k consecutive swaps. Examples : Input : arr[] =… Read More »

## Lexicographically next greater string using same character set

Given a number K and a string S, We have to Find the lexicographically smallest string str of length K such that it’s set of… Read More »

## Lexicographical concatenation of all substrings of a string

Given a string, find concatenation of all substrings in lexicographic order. Examples: Input : s = “abc” Output : aababcbbcc The substrings of s in… Read More »

## Make a lexicographically smallest palindrome with minimal changes

Given a string S. Print the lexicographically smallest string possible. You can make minimal changes to the characters in the string and you can permute… Read More »

## Find a string in lexicographic order which is in between given two strings

Given two strings S and T, find a string of the same length which is lexicographically greater than S and smaller than T. Print “-1”… 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 : Input : “hello python program how are you” Output… Read More »

## Construct lexicographically smallest palindrome

Given a string of lowercase alphabets. Some of characters of given string got corrupted and are now represented by *. We can replace * with… Read More »

## Lexicographically smallest permutation with distinct elements using minimum replacements

Given an array of n positive integers such that each element of integer is from 1 to n. Find the lexicographically permutation that can be… Read More »

## Lexicographically next string

Given a string, find lexicographically next string. Examples: Input : geeks Output : geekt The last character ‘s’ is changed to ‘t’. Input : raavz… Read More »

## Lexicographically smallest string whose hamming distance from given string is exactly K

Given a lowercase string A of length N and an integer K, find the lexicographically smallest string B of the same length as A such… Read More »

## Lexicographically largest subsequence such that every character occurs at least k times

Given a string S and an integer K. The task is to find lexicographically largest subsequence of S, say T, such that every character in… Read More »