Reverse an Array

Published by Bjarte in

Write a function to reverse an array.

Examples

Reverse(new int[] {1, 2, 3, 4}) ➞ {4, 3, 2, 1}

Reverse(new int[] {9, 9, 2, 3, 4}) ➞ {4, 3, 2, 9, 9}

Reverse(new int[] {}) ➞ {}

Notes

  • Don't forget to return the result.
  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.
Watch a quick demo on how Edabit works.