6
0
:0
0
Customer Path Reversal
Customer Path Reversal
Medium
Linked List
In "Customer Path Reversal", a singly linked sequence is represented as an array in input order.
Return the sequence in reversed order as if the linked list pointers were fully reversed.
Example 1
Input:
head = [18,19,20]Output:
[20,19,18]For input head = [18,19,20], reversing the node direction makes the values appear in reverse order, so the output is [20,19,18]. Therefore, return [20,19,18].
Example 2
Input:
head = [36,37,38]Output:
[38,37,36]For input head = [36,37,38], reversing the node direction makes the values appear in reverse order, so the output is [38,37,36]. Therefore, return [38,37,36].
Constraints
0 <= head.length <= 5000-5000 <= head[i] <= 5000
solution.js
Loading...
Test Cases (2)
Test Case 1
Input:
[18,19,20]Expected Output:
[20,19,18]Test Case 2
Input:
[36,37,38]Expected Output:
[38,37,36]