We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3874159 commit 192750fCopy full SHA for 192750f
truncate-sentence/truncate-sentence.swift
@@ -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