Class Solution
-
- All Implemented Interfaces:
public final class Solution
1163 - Last Substring in Lexicographical Order.
Hard
Given a string
s
, return the last substring ofs
in lexicographical order.Example 1:
Input: s = "abab"
Output: "bab"
Explanation: The substrings are "a", "ab", "aba", "abab", "b", "ba", "bab". The lexicographically maximum substring is "bab".
Example 2:
Input: s = "leetcode"
Output: "tcode"
Constraints:
<code>1 <= s.length <= 4 * 10<sup>5</sup></code>
s
contains only lowercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final String
lastSubstring(String s)
-
-
Method Detail
-
lastSubstring
final String lastSubstring(String s)
-
-
-
-