arrow_back Back to Challenges

#14 Longest Common Prefix

Easy Acceptance 0%
description

Problem Description

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 `""`.

checklist Constraints

1 <= strs.length <= 200
0 <= strs[i].length <= 200
strs[i] consists of only lowercase English letters.

science Examples

Case #1

In: strs = ["flower","flow","flight"]
Out: "fl"

Case #2

In: strs = ["dog","racecar","car"]
Out: ""

Mastery Tags

Strings

Hiring Companies

Adobe Amazon Google
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude