fixed reverse implementation

This commit is contained in:
Timon Ringwald 2022-08-21 14:08:25 +02:00
parent fc31b733b4
commit 2fb5ea542d

View File

@ -4,7 +4,7 @@ func Reverse[T any](slice []T) []T {
s := make([]T, len(slice)) s := make([]T, len(slice))
for i := 0; i < len(slice); i++ { for i := 0; i < len(slice); i++ {
ri := len(slice) - 1 - i ri := len(slice) - 1 - i
s[ri] = s[i] s[ri] = slice[i]
} }
return s return s
} }