Given the head of a singly linked list, walk the list from head to tail and return an array of the node values in order.
Input
head: head node of a singly linked list (may be null)
Output
An array of the values from head to tail. Return an empty array for an empty list.
Examples
Example 1
Inputhead = [1, 2, 3]
Output[1, 2, 3]
Example 2
Inputhead = [1]
Output[1]
Constraints
The list has 0 or more nodes.
Values fit in a standard integer.