At Dropbox, file path suggestions may share a common starting segment. Given an array of strings, write a function that returns the longest common prefix shared by all strings.
If there is no common prefix, return an empty string "".
strsA correct solution should compare prefixes efficiently and handle edge cases such as a single string, empty strings, or an immediate mismatch at the first character.
def longest_common_prefix(strs):