JetBrains interview question

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