All challenges

Algorithm challenge · DSA

Longest Common Prefix

Difficulty

easy

Time

~15m

Format

Single

Grading

Auto-graded

#python#javascript#typescript#go#java#cpp#rust#dsa#strings
Mission file // read carefullyeasy

Find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "".

strs = ["flower","flow","flight"]  =>  "fl"

Build with

longestCommonPrefix(strs: string[]) → string
PythonJavaScriptTypeScriptGoJavaC++Rust
2 tests
Auto-graded on submit
Start challenge

Sign in to save your progress.