Lexicographically Smallest String
2 posts1 contributor
+ FollowBe the first to follow this
Write about itArticles about Lexicographically Smallest String
Secret Cipher – O(n) Java Solution Using KMP
Learn how to solve the Secret Cipher problem efficiently using the KMP (Knuth-Morris-Pratt) prefix function / LPS array in Java. This article explains how repeated prefixes can be identified and compressed using *, how the algorithm constructs the lexicographically smallest encrypted string, and how to achieve O(n) time complexity for strings up to 105 characters.
Lexicographically Smallest String After Removing K Characters Using a Monotonic Stack
Learn how to find the lexicographically smallest string after removing K characters using a monotonic stack in Java. Includes explanation, dry run, and optimized O(n) solution.
