Skip to content

Practice Last Substring in Lexicographical Order

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#1163
LeetCode Problem

Last Substring in Lexicographical Order

Problem Statement

Given a string s, return the last substring of s in lexicographical order.

Source: Last Substring in Lexicographical Order on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "abab"
Output
"bab"

# Example 2

Input
s = "leetcode"
Output
"tcode"

Constraints

1 <= s.length <= 4 * 10^5
s contains only lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Last Substring in Lexicographical Order.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.