Soal
00:00

10. Longest Common Prefix

MudahStringGoogleMicrosoft

Write a function that finds the longest common prefix among an array of strings.

Contoh 1:

Input: strs = ["flower","flow","flight"]
Output: fl

Contoh 2:

Input: strs = ["dog","racecar","car"]
Output: 

Batasan:

  • 1 <= strs.length <= 200
Mode kode inti
● Tersimpan otomatisBaris 1, kolom 1