longestPrefix interview question solution
This is my attempt at solving the longestPrefix interview question from cassidoo's weekly newsletter.
This is my attempt at solving the longestPrefix interview question from cassidoo's weekly newsletter.
Question:
Write a function to find the longest common prefix string in an array of strings.
Example:
$ longestPrefix(["cranberry","crawfish","crap"])
$ "cra"
$ longestPrefix(["parrot", "poodle", "fish"])
$ ""
Solution (try using browsing from a laptop if it doesn't load anything):
Comments and suggestions are welcome.