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的主要内容,如果未能解决你的问题,请参考以下文章