Compare commits

...

5 Commits

Author SHA1 Message Date
Tiago Collot 9208f3bc66 docs(secondhalf): instructions upgrade 2 years ago
Tiago Collot 0f7f6de9be docs(secondhalf): refix in subject instructions and output 2 years ago
Tiago Collot 7c0176fe12 docs(secondhalf): rename exercise folder 2 years ago
Tiago Collot 18d1aab968 docs(secondhalf): fix subject 2 years ago
hamza fa7e74a9e9 DEV-3189 add(docs):add subject of secondHalf ex 2 years ago
  1. 41
      subjects/secondhalf/README.md

41
subjects/secondhalf/README.md

@ -0,0 +1,41 @@
## secondhalf
### Instructions
Write a function `SecondHalf()` that receives a slice of `int` and returns another slice of `int` with the second half of the values.
- If the length is odd, round it up.
### Expected function
```go
func SecondHalf(slice []int) []int {
}
```
### Usage
Here is a possible program to test your function:
```go
package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(piscine.SecondHalf([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}))
fmt.Println(piscine.SecondHalf([]int{1, 2, 3}))
}
```
And its output:
```console
$ go run . | cat -e
[6 7 8 9 10]
[2 3]
```
Loading…
Cancel
Save