mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-20 22:17:09 +08:00
Update 几道常见的字符串算法题.md
This commit is contained in:
parent
671450a131
commit
9a0c3251cf
@ -68,6 +68,12 @@ public class Solution {
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
对于替换固定字符(比如空格)的情况,第二种方法其实可以使用 `replace` 方法替换,性能更好!
|
||||||
|
|
||||||
|
```java
|
||||||
|
str.toString().replace(" ","%20");
|
||||||
|
```
|
||||||
|
|
||||||
## 3. 最长公共前缀
|
## 3. 最长公共前缀
|
||||||
|
|
||||||
> Leetcode: 编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串 ""。
|
> Leetcode: 编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串 ""。
|
||||||
|
Loading…
x
Reference in New Issue
Block a user