mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
690 B
39 lines
690 B
2 years ago
|
## reverse-strings
|
||
|
|
||
|
### Instructions
|
||
|
|
||
2 years ago
|
Write a function that takes a slice of strings and returns a single string containing them in reverse order with a space between each element of the slice. If the slice is empty, return an empty string.
|
||
2 years ago
|
|
||
|
### Expected function
|
||
|
|
||
|
```go
|
||
|
func ReverseStrings(strs []string) string {
|
||
|
|
||
|
}
|
||
|
```
|
||
|
|
||
|
### Usage
|
||
|
|
||
|
Here is a possible program to test your function:
|
||
|
|
||
10 months ago
|
```go
|
||
2 years ago
|
package main
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func main(){
|
||
|
fmt.Println(ReverseStrings([]string{"a", "b", "c"}))
|
||
|
fmt.Println(ReverseStrings([]string{"Good","Morning!"}))
|
||
|
fmt.Println(ReverseStrings([]string{"Hello World"}))
|
||
|
}
|
||
|
```
|
||
|
|
||
10 months ago
|
And its output :
|
||
2 years ago
|
|
||
|
```console
|
||
|
$ go run .
|
||
|
c b a
|
||
|
!gninroM dooG
|
||
|
dlroW olleH
|
||
2 years ago
|
```
|