Longest Common Prefix
Find the longest start shared by every word by reading the words column by column until one differs.
01The problem
Given an array of words strs, return the longest prefix (start) that all of them share, or "" if there is none.
| Input | Output |
|---|---|
["flower", "flow", "flight"] | "fl" |
["dog", "racecar", "car"] | "" |
Loading the rest of the lesson…