Reverse reverses the order of the elements in the slice.
(a []T)
| 34 | |
| 35 | // Reverse reverses the order of the elements in the slice. |
| 36 | func Reverse[T any](a []T) { |
| 37 | for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 { |
| 38 | a[i], a[j] = a[j], a[i] |
| 39 | } |
| 40 | } |
no outgoing calls