Longest Common Prefix
Easy
Strings
String
Find the longest common prefix string amongst an array of strings.
Constraints
1 ≤ strs.length ≤ 200
Examples
Example 1:
Input: flower
flow
flight
Output: fl
Example 2:
Input: dog
racecar
car
Output:
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console