forked from root/public
![hamzaelkhatri@gmail.com](/git/assets/img/avatar_default.png)
![Hamza elkhatri](/git/assets/img/avatar_default.png)
1 changed files with 38 additions and 0 deletions
@ -0,0 +1,38 @@
|
||||
## reverse-strings |
||||
|
||||
### Instructions |
||||
|
||||
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. |
||||
|
||||
### Expected function |
||||
|
||||
```go |
||||
func ReverseStrings(strs []string) string { |
||||
|
||||
} |
||||
``` |
||||
|
||||
### Usage |
||||
|
||||
Here is a possible program to test your function: |
||||
|
||||
```go |
||||
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"})) |
||||
} |
||||
``` |
||||
|
||||
And its output : |
||||
|
||||
```console |
||||
$ go run . |
||||
c b a |
||||
!gninroM dooG |
||||
dlroW olleH |
||||
``` |
Loading…
Reference in new issue