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
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.