fixed reverse implementation
This commit is contained in:
parent
fc31b733b4
commit
f7bc1279f6
@ -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…
x
Reference in New Issue
Block a user