Update reverse-array.go

pull/1161/head
Leonardo Gonfiantini 2023-05-27 12:16:19 +02:00 committed by GitHub
parent aa27a50d56
commit 449bd57f2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -6,9 +6,7 @@ package arrays
import ("fmt")
func TestReverseArray() {
// create an array of integers
arr := []int{1, 2, 3, 4, 5}
func ReverseArray(arr int[]) {
// get the length of the array
n := len(arr)
// iterate over half of the array and swap corresponding elements