Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 14. Longest Common Prefix
Return the longest prefix string common to all strings in the array, or an empty string if none exists. The task reduces to comparing characters across all strings position-by-position up to the shortest string and stopping at the first mismatch.
Asked at:
Meta
V
Visa
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Late April, 2025
V
Visa
Mid-level
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 "".
Early January, 2025
Meta
Staff
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.