诚心请教:分子靶向治疗肿瘤效果如何?# Living
w*y
1 楼
考古pinterest面经,看到两个类似的题目
这个在glassdoor看到的:给一组words,找longest common substring
英文原文:given an array of words find what is and how long is the length of
the longest common substring between two words in the array
这个在本版看到的:
"给一组字符串,找最长的公共前缀,至少两个字符串公共"
这个给了解法,没看懂5555
[hash all prefixes of one string and then scan through
def longest_common_prefix(strings):
first = strings[0]
l = len(first)
prefixes = set([first[:i] for i in range(l+1)])
for s in strings[1:]:
l = min(l, len(s))
while s[:l] in prefixes:
l -= 1
return first[:l]
求高手指点一下,我好像只能想明白两两组合的暴力解法//汗
这个在glassdoor看到的:给一组words,找longest common substring
英文原文:given an array of words find what is and how long is the length of
the longest common substring between two words in the array
这个在本版看到的:
"给一组字符串,找最长的公共前缀,至少两个字符串公共"
这个给了解法,没看懂5555
[hash all prefixes of one string and then scan through
def longest_common_prefix(strings):
first = strings[0]
l = len(first)
prefixes = set([first[:i] for i in range(l+1)])
for s in strings[1:]:
l = min(l, len(s))
while s[:l] in prefixes:
l -= 1
return first[:l]
求高手指点一下,我好像只能想明白两两组合的暴力解法//汗