Skip to content

Commit

Permalink
Update kama55.右旋字符串.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gdstzmy authored Nov 16, 2023
1 parent bb66452 commit 972ca2d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions problems/kama55.右旋字符串.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,34 @@ public class Main {


### Go:
```go
package main
import "fmt"

func reverse (strByte []byte, l, r int){
for l < r {
strByte[l], strByte[r] = strByte[r], strByte[l]
l++
r--
}
}


func main(){
var str string
var target int

fmt.Scanln(&target)
fmt.Scanln(&str)
strByte := []byte(str)

reverse(strByte, 0, len(strByte) - 1)
reverse(strByte, 0, target - 1)
reverse(strByte, target, len(strByte) - 1)

fmt.Printf(string(strByte))
}
```


### JavaScript:
Expand Down

0 comments on commit 972ca2d

Please sign in to comment.