Construct the Lexicographically Largest Valid Sequence | Leetcode 1718