Substitute Spaces
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
- [移除元素](./remove_elements.md)
|
||||
- [长度最小的子数组](./minimum_size_subarray_sum.md)
|
||||
|
||||
# 字符串
|
||||
|
||||
- [替换空格](./substitute_spaces.md)
|
||||
|
||||
# 经典代码
|
||||
|
||||
- [合并两个有序链表](./merge_two_sorted_linked_lists.md)
|
||||
|
15
notes/src/substitute_spaces.md
Normal file
15
notes/src/substitute_spaces.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# 替换空格
|
||||
|
||||
[Leetcode](https://leetcode.cn/problems/ti-huan-kong-ge-lcof/)
|
||||
|
||||
请实现一个函数,把字符串 s 中的每个空格替换成"%20"。
|
||||
|
||||
示例 1:
|
||||
|
||||
> 输入:s = "We are happy."
|
||||
>
|
||||
> 输出:"We%20are%20happy."
|
||||
|
||||

|
||||
|
||||
对于很多数组填充类问题,都可以先计算出扩展后数组的长度,然后从后往前双指针。
|
Reference in New Issue
Block a user