14. Longest Common Prefix
EasyString
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 "".
Examples
Input: ["flower","flow","flight"]
Output: fl
Explanation: All three share 'fl'; they diverge at the third character.
Constraints
- 1 <= strs.length <= 200
- 0 <= strs[i].length <= 200
- strs[i] consists of only lowercase English letters if it is non-empty.
Loading...
Run checks all cases above. Submit evaluates all test cases.