Given the head of a doubly linked list, collect all node values by traversing from head to tail, then return an array of values in reverse order (tail to head) without modifying the list.
First reach the tail using next pointers, then traverse back using prev pointers.
Input: Head of a doubly linked list.
Output: Array of node values from tail to head.
Input: [1,2,3,4,5]
Output: [5,4,3,2,1]
Explanation: Traverse next to tail(5). Traverse prev: 5→4→3→2→1. Collect [5,4,3,2,1].Input: [10,20,30]
Output: [30,20,10]
Explanation: Tail=30. Reverse: [30,20,10].Input: [7]
Output: [7]
Explanation: Single node. Tail=head. Return [7].1<=nodes<=10^5-10^9<=Node.val<=10^9