Implement a function that reverses a slice of integers Technology Community › Category: Golang › Implement a function that reverses a slice of integers 0 Vote Up Vote Down VietMX Staff asked 4 years ago func reverse(s []int) { for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { s[i], s[j] = s[j], s[i] } } func main() { a := []int{1, 2, 3} reverse(a) fmt.Println(a) // Output: [3 2 1] }