标签:tar ref str through http lis ring cti span
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
标签:tar ref str through http lis ring cti span
原文地址:http://www.cnblogs.com/asenyang/p/6939632.html