魔法师 (@Constanline)Leetcode每日一题 —— 3302. 字典序最小的合法序列 中发帖

思路
来晚了。虽然应该过不了,但先试试dfs,这个容易想到。 
结果直接过了 🤣 但是2000+ms也太拉胯了。 
代码
class Solution {
    char[] word1, word2;
    int[] ans;
    public int[] validSequence(String word1, String word2) {
        this.word1 = word1.toCharArray();
        this.word2 = word2.toCharArray();
        ans = new int[word2.length()];
        if (find(0, 0, true)) {
            return ans;
        }
        return new int[0];
   ...
 
 
Back to Top