Flatten Binary Tree to Linked List

Flatten a binary tree into a linked list following preorder traversal. Return the list of values from the right pointers.

Examples
Input: [1,2,5,3,4,null,6]
Output: []
Hints

Flatten Binary Tree to Linked List

Flatten a binary tree into a linked list following preorder traversal. Return the list of values from the right pointers.