Problems

10. Longest Common Prefix

EasyStringGoogleMicrosoft

Write a function that finds the longest common prefix among an array of strings.

Example 1:

Input: strs = ["flower","flow","flight"]
Output: fl

Example 2:

Input: strs = ["dog","racecar","car"]
Output: 

Constraints:

  • 1 <= strs.length <= 200
Core code mode
● Auto-savedLine 1, column 1