Update reverse-array.go
parent
aa27a50d56
commit
449bd57f2b
|
@ -6,9 +6,7 @@ package arrays
|
||||||
|
|
||||||
import ("fmt")
|
import ("fmt")
|
||||||
|
|
||||||
func TestReverseArray() {
|
func ReverseArray(arr int[]) {
|
||||||
// create an array of integers
|
|
||||||
arr := []int{1, 2, 3, 4, 5}
|
|
||||||
// get the length of the array
|
// get the length of the array
|
||||||
n := len(arr)
|
n := len(arr)
|
||||||
// iterate over half of the array and swap corresponding elements
|
// iterate over half of the array and swap corresponding elements
|
||||||
|
|
Loading…
Reference in New Issue