All Posts
Leetcode 1593: Split a String Into the Max Number of Unique Substrings
Given a string s, your task is to split it into the maximum number of non-empty substrings such that all substrings are unique. You are allowed to split the string in any way, but each substring in the split must not repeat.
Leetcode 1718: Construct the Lexicographically Largest Valid Sequence
Given an integer n
, find a sequence of length 2n - 1
that satisfies the following conditions:
- The integer
1
occurs once in the sequence. - Each integer between
2
andn
occurs twice in the sequence. - For every integer
i
between2
andn
, the distance between the two occurrences ofi
is exactlyi
. - The sequence should be lexicographically the largest possible sequence.
The sequence is considered lexicographically larger if, at the first position where the two sequences differ, the number in the first sequence is greater.