Skip to content

Tag Archives: lexicographic-ordering

Given a string S. The task is to print the K-th lexicographically the smallest one among the different substrings of s.A substring of s is… Read More
Given a string consisting of only 0’s and 1’s. Now you are given N non-intersecting ranges L, R ( L <= R), more specifically [L1,… Read More
Given a m x n matrix of positive integers. The task is to find the number of paths from the top left of the matrix… Read More
Given a string str, print of all the combinations of a string in lexicographical order.Examples:   Input: str = "ABC" Output: A AB ABC AC ACB… Read More
Given two strings a and b. Our task is to print any string which is greater than a(lexicographically) but smaller than b(lexicographically). If it is… Read More
Given an integer N, the task is to find a string(considering only lowercase characters) of length (N+1) such that the character at any position should… Read More
Given a string S consisting of lowercase alphabets. The task is to find the lexicographically smallest string X of the same length only that can… Read More
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
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
Given a string s we have to find the lexicographical maximum substring of a string Examples:  Input : s = "ababaa" Output : babaa Explanation… Read More
Given n strings, concatenate them in an order that produces the lexicographically smallest possible string. Examples:   Input : a[] = ["c", "cb", "cba"] Output :… Read More
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
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
Given a string, find concatenation of all substrings in lexicographic order. Examples:  Input : s = “abc” Output : aababcbbcc The substrings of s in lexicographic order… Read More
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

Start Your Coding Journey Now!