How do the n linked lists in the array end and join each other?

there are n linked lists in an array (length n), for example,
[
a-> b-> c,
d-> e-> f,
g
]
want to connect these n linked lists from end to end. How can this be achieved?

Nov.30,2021

arr.reduce((prev,cur)=>prev->cur)
Menu