Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f05d31

Browse files
authored
Merge pull requestneetcode-gh#1950 from laitooo/0014-longest-common-prefix.dart
Create 0014-Longest-Common-Prefix.dart
2 parents43951f1 +c5356e8 commit3f05d31

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎dart/0014-longest-common-prefix.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
classSolution {
2+
StringlongestCommonPrefix(List<String> strs) {
3+
String res="";
4+
for (int i=0; i<strs[0].length; i++) {
5+
for (String sin strs) {
6+
if (i>= s.length|| strs[0][i]!= s[i]){
7+
return res;
8+
}
9+
}
10+
res+= strs[0][i];
11+
}
12+
return res;
13+
}
14+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp