Skip to content

Commit 192750f

Browse files
committed
Time: 8 ms (84.09%), Space: 14.9 MB (13.64%) - LeetHub
1 parent 3874159 commit 192750f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Solution {
2+
func truncateSentence(_ s: String, _ k: Int) -> String {
3+
s.components(separatedBy: " ").prefix(k).joined(separator: " ")
4+
}
5+
}

0 commit comments

Comments
 (0)