Question d’entretien chez JetBrains

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