Tap here to switch tabs
Problem
Submissions

Problem: Longest Common Prefix

Longest Common Prefix asks you to examine an array of strings and return the longest text shared at the beginning of every string, or an empty string if none is common.

Statement

Given an array of strings, strs, write a function to find the longest common prefix string in strs. If there is no common prefix, return an empty string, "".

Constraints:

  • 1≤1 \leq strs.length ≤200\leq 200

  • 0≤0 \leq strs[i].length ≤200\leq 200

  • strs[i] consists of only lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Common Prefix

Longest Common Prefix asks you to examine an array of strings and return the longest text shared at the beginning of every string, or an empty string if none is common.

Statement

Given an array of strings, strs, write a function to find the longest common prefix string in strs. If there is no common prefix, return an empty string, "".

Constraints:

  • 1≤1 \leq strs.length ≤200\leq 200

  • 0≤0 \leq strs[i].length ≤200\leq 200

  • strs[i] consists of only lowercase English letters.