Medium20 min
Read a Linked List
Return an array of values from the linked list, following next from the first node until null.
Your function
Implement solve(value, extra) in JavaScript. Return the answer; printing alone does not count as a result.
Examples
Input:
[{"value":1,"next":{"value":2,"next":null}}]Output:
[1,2]Input:
[null]Output:
[]Constraints
Input contains at most 1,000 values or characters. Numbers are finite integers. Inputs follow the structure shown in the examples.