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.Loading editor...
[1,2,3,4,5] 5