String Minimal Representation¶ Table of Contents¶ 1163. Last Substring in Lexicographical Order (Hard) 899. Orderly Queue (Hard) 3403. Find the Lexicographically Largest String From the Box I (Medium) 1163. Last Substring in Lexicographical Order¶ LeetCode | 力扣 Tags: Two Pointers, String 899. Orderly Queue¶ LeetCode | 力扣 Tags: Math, String, Sorting 3403. Find the Lexicographically Largest String From the Box I¶ LeetCode | 力扣 Tags: Two Pointers, String, Enumeration Python # Lexicographically Smallest/Largest def answerString(word: str, numFriends: int) -> str: if numFriends == 1: return word n = len(word) return max(word[i : i + n - numFriends + 1] for i in range(n)) if __name__ == "__main__": assert answerString("dbca", 2) == "dbc"