Replay the Events Backwards

Basic

A debugging view replays a sequence of events from newest to oldest. Given the events in order, return them reversed.

Implement `solve(List<Integer> nums)` to return the values in reverse order.

Examples

Input[1, 2, 3, 4, 5]
Output[5, 4, 3, 2, 1]
Input[9]
Output[9]
Hints
  • Iterate from the last index down to 0, adding each to the result.
Anonymous Apex

Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.