Update 1816 solution

This commit is contained in:
halfrost
2021-12-14 21:21:21 +08:00
parent b1ddc35006
commit d845577eac
9 changed files with 94 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# [1816. Truncate Sentence](https://leetcode-cn.com/problems/truncate-sentence/)
# [1816. Truncate Sentence](https://leetcode.com/problems/truncate-sentence/)
## 题目
@ -49,8 +49,8 @@ You are given a sentence s and an integer k. You want to truncate s such that it
## 解题思路
- 遍历字符串s找到最后一个空格的下标end
- 如果end0直接返回s,否则返回s[:end]
- 遍历字符串 s找到最后一个空格的下标 end
- 如果 end0直接返回 s,否则返回 s[:end]
## 代码