#53 · Strings · Intermediate · 55 XP · about 8 min
Write common_prefix(words) that returns the longest string that every word in words starts with. When the words do not even share their first letter, or the list is empty, return an empty string.
common_prefix(["interview", "internet", "interval", "internal"]) # returns 'inter' common_prefix(["dog", "dot", "door"]) # returns 'do' common_prefix(["dog", "cat", "cow"]) # returns ''
words has 0 to 1,000 items.First solves only, ranked by stars and then time.