LC: 1265. Print Immutable Linked List in Reverse - spiralgo/algorithms GitHub Wiki

1265. Print Immutable Linked List in Reverse:

The Essence:

The first node that needs to be printed is the tail of the linked list. After this, the procedure must somehow return to the previous node continually until it reaches back he head.

Details: This can be implemented recursively. Instead of first printing a node, we call the printLinkedListInReverse function with its next node as argument. Thus, a node only prints after its next node has printed.