Watch 10 video solutions for Convert Doubly Linked List to Array II, a medium level problem involving Array, Linked List, Doubly-Linked List. This walkthrough by NeetCode has 99,168 views views. Want to try solving it yourself? Practice on FleetCode or read the detailed text solution.
You are given an arbitrary node from a doubly linked list, which contains nodes that have a next pointer and a previous pointer.
Return an integer array which contains the elements of the linked list in order.
Example 1:
Input: head = [1,2,3,4,5], node = 5
Output: [1,2,3,4,5]
Example 2:
Input: head = [4,5,6,7,8], node = 8
Output: [4,5,6,7,8]
Constraints:
[1, 500].1 <= Node.val <= 1000Node.val.