leetcode524

Posted AsenYang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode524相关的知识,希望对你有一定的参考价值。

public class Solution {
    public string FindLongestWord(string s, IList<string> d) {
        string longest = "";
            foreach (var dictWord in d)
            {
                int i = 0;
                foreach (var c in s)
                {
                    if (i < dictWord.Length && c == dictWord[i])
                    {
                        i++;
                    }
                }

                if (i == dictWord.Length && dictWord.Length >= longest.Length)
                {
                    if (dictWord.Length > longest.Length || dictWord.CompareTo(longest) < 0)
                    {
                        longest = dictWord;
                    }
                }
            }
            return longest;
    }
}

https://leetcode.com/problems/longest-word-in-dictionary-through-deleting/#/description

以上是关于leetcode524的主要内容,如果未能解决你的问题,请参考以下文章

LeetCode 524. Longest Word in Dictionary through Deleting

leetcode中等524通过删除字母匹配到字典里最长单词

Leetcode刷题100天—524. 通过删除字母匹配到字典里最长单词(双指针)—day38

Leetcode刷题100天—524. 通过删除字母匹配到字典里最长单词(双指针)—day38

LeetCode 524. 通过删除字母匹配到字典里最长单词(动态规划) / 695. 岛屿的最大面积 / 54. 螺旋矩阵(背)

LeetCode 524. Longest Word in Dictionary through Deleting (通过删除字母匹配到字典里最长单词)