Courses
Tutorials
Interview Prep
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
Similar Topics
Web Technologies
32.1K+ articles
DSA
20.4K+ articles
Misc
7.7K+ articles
Mathematical
5.1K+ articles
Arrays
4.2K+ articles
Strings
2.1K+ articles
Greedy
1.4K+ articles
Sorting
1.1K+ articles
substring
358+ articles
permutation
257+ articles
lexicographic-ordering
167+ posts
Recent Articles
Make the String lexicographically larger
Last Updated: 16 September 2023
Given a string str of length n. The task is to find a lexicographic largest string where you are allowed to shift one character from str to any other index only one time.E...
read more
Strings
DSA
lexicographic-ordering
Create lexicographically minimum String using given operation
Last Updated: 23 July 2025
Given a string s of length N consisting of digits from 0 to 9. Find the lexicographically minimum sequence that can be obtained from given string s by performing the given...
read more
Strings
Greedy
Technical Scripter
Technical Scripter 2022
DSA
lexicographic-ordering
Generate all the numbers up to N in Lexicographical Order using Stack
Last Updated: 23 July 2025
Given an integer N, the task is to print all numbers up to N in Lexicographical order.Examples:Input: N = 20Output: 1 10 11 12 13 14 15 16 17 18 19 2 3 4 5 6 7 8 9Input: N...
read more
Stack
Technical Scripter
Picked
Technical Scripter 2022
DSA
lexicographic-ordering
Find lexicographically first ID of each domain from given Array of email IDs
Last Updated: 23 July 2025
You are given an array of Email IDs, the task is to return the lexicographically first email ID of every single domain.Examples:Input: Emails[] = {"ajay@gmail.com", "rahul...
read more
Strings
Sorting
Technical Scripter
DSA
Hash
lexicographic-ordering
Lexicographically Smallest by Removing K
Last Updated: 16 May 2026
Given a string s consisting of only lowercase characters, the task is to find the lexicographically smallest string after removing exactly k characters from the string. Bu...
read more
Strings
Stack
Greedy
Technical Scripter
Picked
Technical Scripter 2022
DSA
lexicographic-ordering
Minimum swaps to make one Array lexicographically smaller than other
Last Updated: 06 December 2022
Consider two arrays arr1[] and arr2[] each of size N such that arr1[] contains all odd numbers between 1 to 2*N and arr2[] contains all even numbers between 1 to 2*N in sh...
read more
Greedy
DSA
Arrays
lexicographic-ordering
Find smallest Substring to be rearranged to make String lexicographically sorted
Last Updated: 05 October 2022
Given a string S, the task is to find out the length of the smallest substring of S that needs to be rearranged so that all the characters of the string S are in lexicogra...
read more
Strings
Greedy
DSA
lexicographic-ordering
substring
Lexicographically smallest Subsequence of Array by deleting all occurrences of one element
Last Updated: 28 November 2022
Given an array A[] of N integers, the task is to find the lexicographically smallest subsequence of the array by deleting all the occurrences of exactly one integer from t...
read more
Greedy
DSA
Arrays
lexicographic-ordering
Build lexicographically smallest String from two given Strings
Last Updated: 23 July 2025
Given two strings X and Y of lowercase letters, of length N and M respectively, the task is to build another string Z by performing two types of operations:Choose any char...
read more
Strings
Greedy
DSA
lexicographic-ordering
Kth non-overlapping Substring of length M after sorting given String lexicographically
Last Updated: 23 July 2025
Given string str of size N and two integers M and K (N is divisible by M), the task is to find the Kth non-overlapping substring of size M after sorting the given string l...
read more
DSA
prefix-sum
lexicographic-ordering
substring
Lexicographically smallest Binary String formed using infinite swaps
Last Updated: 23 July 2025
Given a binary string s of length N, the task is to find the lexicographically smallest string using infinite number of swaps between 0's and 1's.Examples:Input: s = "1001...
read more
Strings
Bit Magic
Greedy
Sorting
Combinatorial
DSA
binary-string
lexicographic-ordering
Swap-Program
Count of Subsequences of given string X in between strings Y and Z
Last Updated: 23 July 2025
Given three strings, 'X', 'Y' and 'Z', the task is to count the number of subsequences of 'X' which is lexicographically greater than or equal to 'Y' and lexicographically...
read more
Strings
Dynamic Programming
Recursion
Geeks Premier League
Geeks-Premier-League-2022
DSA
subsequence
lexicographic-ordering
Find Mth lexicographically smallest Binary String with no two adjacent 1
Last Updated: 23 July 2025
Given two integers N and M, the task is to find the Mth lexicographically smallest binary string (have only characters 1 and 0) of length N where there cannot be two conse...
read more
Strings
Greedy
Recursion
DSA
lexicographic-ordering
Lexicographically smallest Permutation of Array by reversing at most one Subarray
Last Updated: 23 July 2025
Given an array arr[] of size N which is a permutation from 1 to N, the task is to find the lexicographically smallest permutation that can be formed by reversing at most o...
read more
Geeks Premier League
Geeks-Premier-League-2022
DSA
Arrays
permutation
subarray
lexicographic-ordering
Lexicographically smallest string formed by reversing Substrings of string S exactly K times
Last Updated: 06 April 2023
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.Examples:...
read more
Strings
Geeks Premier League
Geeks-Premier-League-2022
DSA
Reverse
lexicographic-ordering
substring
1
2
3
4
...
12