fixed reverse implementation
This commit is contained in:
parent
fc31b733b4
commit
2fb5ea542d
@ -4,7 +4,7 @@ func Reverse[T any](slice []T) []T {
|
||||
s := make([]T, len(slice))
|
||||
for i := 0; i < len(slice); i++ {
|
||||
ri := len(slice) - 1 - i
|
||||
s[ri] = s[i]
|
||||
s[ri] = slice[i]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user