Dev
Mentor
Coach Interview AI
Mock Interview AI
Coding Problems
Blog
Pricing
Toggle theme
Sign In
Get Started
Toggle theme
Loading...
For the best coding experience, use a desktop browser.
Easy
String
Longest Common Prefix
Find the longest common prefix among an array of strings.
Examples
Input:
strs = ["flower","flow","flight"]
Output:
"fl"
Sample Test Cases
Case 1 Input:
["flower","flow","flight"]
Expected:
"fl"
Case 2 Input:
["dog","racecar","car"]
Expected:
""
Reset
Run
Submit
Loading editor...
Test Case
Output
Submission
Case 1 Input:
["flower","flow","flight"]
Expected:
"fl"
Case 2 Input:
["dog","racecar","car"]
Expected:
""