Skip to content
6
0
:
0
0

Reverse Task Queue: Playlist Recovery Edition

Medium

Linked List

In "Reverse Task Queue: Playlist Recovery 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 = [23,24,25,26]
Output:[26,25,24,23]

For input head = [23,24,25,26], reversing the node direction makes the values appear in reverse order, so the output is [26,25,24,23]. Therefore, return [26,25,24,23].

Example 2

Input:head = [46,47]
Output:[47,46]

For input head = [46,47], reversing the node direction makes the values appear in reverse order, so the output is [47,46]. Therefore, return [47,46].

Constraints

  • 0 <= head.length <= 5000
  • -5000 <= head[i] <= 5000
solution.js
Loading...

Test Cases (2)

Test Case 1
Input:
[23,24,25,26]
Expected Output:
[26,25,24,23]
Test Case 2
Input:
[46,47]
Expected Output:
[47,46]