6
0
:0
0
Backtrack Navigation Chain: Navigation Rollback Edition
Backtrack Navigation Chain: Navigation Rollback Edition
Easy
Linked List
In "Backtrack Navigation Chain: Navigation Rollback Edition", 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 = [24,25,26,27,28]Output:
[28,27,26,25,24]For input head = [24,25,26,27,28], reversing the node direction makes the values appear in reverse order, so the output is [28,27,26,25,24]. Therefore, return [28,27,26,25,24].
Example 2
Input:
head = [48,49,50]Output:
[50,49,48]For input head = [48,49,50], reversing the node direction makes the values appear in reverse order, so the output is [50,49,48]. Therefore, return [50,49,48].
Constraints
0 <= head.length <= 5000-5000 <= head[i] <= 5000
solution.js
Loading...
Test Cases (2)
Test Case 1
Input:
[24,25,26,27,28]Expected Output:
[28,27,26,25,24]Test Case 2
Input:
[48,49,50]Expected Output:
[50,49,48]