Easy15 pts
Reverse a Sequence
Given a sequence of n integers, reverse it in place and print the result. This simulates reversing a linked list - use two pointers or stack approach. Example: [1,2,3,4,5] → [5,4,3,2,1]
Input
Line 1: n. Line 2: n space-separated integers.
Output
The reversed sequence as space-separated integers.
Sample
5 1 2 3 4 5
Expected
5 4 3 2 1
Loading editor…
Output
No output yet. Run your code to see results.