Easy · Linked Lists

Print from end

Given the head of a singly linked list, return its node values in reverse order, from the tail to the head, without modifying the list.

Examples

Example 1

{
  "values": [1, 2, 3, 4]
}

Output: [4, 3, 2, 1]

Example 2

{
  "values": [5, 9, 2]
}

Output: [2, 9, 5]

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Linked Lists problems