Skip to content

Commit 2bb4e9b

Browse files
committed
Fix empty list guard
1 parent 015ee2f commit 2bb4e9b

File tree

1 file changed

+1
-1
lines changed
  • lib/src/easy/14.longest_common_prefix

1 file changed

+1
-1
lines changed

lib/src/easy/14.longest_common_prefix/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
class Solution {
1010
String longestCommonPrefix(List<String> strs) {
11-
if (strs.isEmpty) return '';
11+
if (strs.join('').isEmpty) return '';
1212
String prefix = strs[0];
1313
for (int i = 1; i < strs.length; i++) {
1414
while (strs[i].indexOf(prefix) != 0) {

0 commit comments

Comments
 (0)