Easy · Strings
Longest common prefix
Given an array of 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
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.