Skip to content

Commit c1fbc98

Browse files
committed
Runtime: 0 ms (Top 100.00%) | Memory: 41.9 MB (Top 35.26%)
1 parent a9a2ef1 commit c1fbc98

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// Runtime: 0 ms (Top 100.00%) | Memory: 41.9 MB (Top 35.26%)
12
class Solution {
23
public int countSegments(String s) {
34
int length = 0;
45
boolean flag = false;
5-
6+
67
for(Character c : s.toCharArray()) {
78
if(c == ' ' && flag) {
89
length++;
@@ -11,7 +12,7 @@ public int countSegments(String s) {
1112
flag = true;
1213
}
1314
}
14-
15+
1516
return flag ? length + 1 : length;
1617
}
17-
}
18+
}

0 commit comments

Comments
 (0)