#1816
Truncate Sentence
newbie · 105 · lc easy +12 · verified · 86.7% accepted · 1,225 likes · top 98%
Description
Given a sentence s and integer k, return s truncated to its first k words. A sentence has words separated by single spaces with no leading or trailing spaces.
Code
1
2
3