# Completing this problem too?

**URL:** <https://discourse.processing.org/t/completing-this-problem-too/17907>\
**Category:** Coding Questions\
**Created:** [February 18, 2020, 3:32am UTC](https://discourse.processing.org/t/completing-this-problem-too/17907 "2020-02-18T03:32:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kandrews](https://avatars.discourse-cdn.com/v4/letter/k/8dc957/32.png) [@kandrews](https://discourse.processing.org/u/kandrews)\
**Post date:** [February 18, 2020, 3:32am UTC](https://discourse.processing.org/t/completing-this-problem-too/17907/1 "2020-02-18T03:32:38Z")

</div>

here is a second problem I don’t know how to solve, any solutions?

Complete the following method. Given an array of ints, return an array with all the same elements but in reverse order.

**public int[] reverse(int[] nums)**

Examples:  
reverse([1,3,5,4]) --\> [4,5,3,1]  
reverse([2,2,9]) --\> [9,2,2]  
reverse([10]) --\> [10]

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [February 18, 2020, 4:06am UTC](https://discourse.processing.org/t/completing-this-problem-too/17907/2 "2020-02-18T04:06:06Z")

</div>

Again, you will need to look at each element in your input list in order.

This time you will also need an output list that your function returns.

How long is the output list?

What is the index of the last item in the output list? How about the second to last? Third to last?

Again, work out how you, as a person, would do this. Come up with a simple list of directions that describes the process. Only after you understand how you would solve it should you start writing code.
