mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
Update kama55.右旋字符串.md
添加python解法,已在kama上测试通过
This commit is contained in:
@ -211,7 +211,17 @@ public class Main {
|
||||
```
|
||||
|
||||
### Python:
|
||||
```Python
|
||||
#注意:python中字符串是不可变的,所以使用python一定要创建新的字符串
|
||||
|
||||
#获取输入的数字k和字符串
|
||||
k = int(input())
|
||||
s = input()
|
||||
|
||||
#通过切片反转第一段和第二段字符串
|
||||
s = s[len(s)-k:] + s[:len(s)-k]
|
||||
print(s)
|
||||
```
|
||||
|
||||
### Go:
|
||||
```go
|
||||
|
Reference in New Issue
Block a user