Easy · Strings
Longest Common Prefix
Given an array of ASCII strings strs, return the longest string that is a prefix of every string in strs, or the empty string if they share no common prefix.
Examples
Example 1
["flower","flow","flight"]Output: "fl"
Example 2
["dog","racecar","car"]Output: "" (no common prefix)
Rebuild it in the studio
Core interview problems are free with a full runner and lessons; Pro opens the complete library.