Domanda di colloquio di JetBrains

You have a single-linked list. Write code to reverse it.