Browse Source

docs(revconcatalternate): fix exercise

pull/1513/head
miguel 12 months ago committed by MSilva95
parent
commit
be24c458d2
  1. 9
      subjects/revconcatalternate/README.md

9
subjects/revconcatalternate/README.md

@ -3,10 +3,13 @@
### Instructions
Write a function `RevConcatAlternate()` that receives two slices of `int` as arguments and returns a new slice with alternated values of each slice in reverse order.
- The input slices can have different lengths.
- The new slice should start with an element of the largest slice first.
- The new slice should start with the elements from the largest slice first and when they became equal size slices, it should add an element of the first given slice.
- If the slices are of equal length, the new slice should start with an element of the first slice.
> Note: you can check the examples bellow for more details.
### Expected function
```go
@ -30,6 +33,7 @@ import (
func main() {
fmt.Println(piscine.RevConcatAlternate([]int{1, 2, 3}, []int{4, 5, 6}))
fmt.Println(piscine.RevConcatAlternate([]int{1, 2, 3}, []int{4, 5, 6, 7, 8, 9}))
fmt.Println(piscine.RevConcatAlternate([]int{1, 2, 3, 9, 8}, []int{4, 5}))
fmt.Println(piscine.RevConcatAlternate([]int{1, 2, 3}, []int{}))
}
```
@ -39,6 +43,7 @@ And its output:
```console
$ go run .
[3 6 2 5 1 4]
[9 3 8 2 7 1 6 5 4]
[9 8 7 3 6 2 5 1 4]
[8 9 3 2 5 1 4]
[3 2 1]
```

Loading…
Cancel
Save