Longest Common Prefix

You are given an array of lowercase strings as an argument. Return the longest common prefix of all strings.

Requirements

  • Must return a string
  • Must be able to compare more than two strings

Example #1

solve(["antiquated", "antilope"])
> "anti"

Example #2

solve(["california", "calibrated"])
> "cali"

Example #3

solve(["test","testing","tester"])
> "test"