Skip to content

Instantly share code, notes, and snippets.

View chriswilkinsoncodes's full-sized avatar
✈️
where to next?

chris wilkinson chriswilkinsoncodes

✈️
where to next?
View GitHub Profile
@chriswilkinsoncodes
chriswilkinsoncodes / longest_prefix.py
Created August 30, 2021 05:29
solution to @cassidoo's "Interview question of the week" 2021-08-30
test_arrs = {
"arr1": ["cranberry","crawfish","crap"], # "cra"
"arr2": ["parrot", "poodle", "fish"], # ""
"arr3": [], # "error"
"arr4": ["", "", ""], # ""
"arr5": ["ab1d", "ab2d", "ab3d"], # "ab"
}
def longest_prefix(arr):
prefix = ""