Strings

Longest Common Prefix

easy
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string `""`. Example: `longestCommonPrefix(["flower","flow","flight"])` → `"fl"`.
Hint steps(0/3 revealed)
  1. 1

    Complete previous step or reveal to unlock this hint.

  2. 2

    Complete previous step or reveal to unlock this hint.

  3. 3

    Complete previous step or reveal to unlock this hint.