Open
Description
Is your feature request related to a problem? Please describe.
Find the longest common prefix of multiple strings.
Describe the solution you'd like
declare function longestCommonPrefix(strs: ArrayLike<string>): string
assertEquals(longestCommonPrefix([]), '')
assertEquals(longestCommonPrefix(['']), '')
assertEquals(longestCommonPrefix(['flower', 'flow', 'flight']), 'fl')
assertEquals(longestCommonPrefix(['flower', 'glow', 'flight']), '')
assertEquals(longestCommonPrefix(['💩', '💫']), '')
Describe alternatives you've considered
Maybe an equivalent under collections
for longest common prefixes of lists (array/ArrayLike
s)?
Metadata
Metadata
Assignees
Labels
No labels