Given the head of a singly linked list, reverse the list, and return the reversed list.

링크드리스트를 뒤집어서 리턴해라

Input

cur = head

head = head.next

cur.next = pre
(장외)
pre = cur

한바퀴 완
두바퀴
cur = head

head = head.next

cur.next = pre

pre = cur

세바퀴
cur = head

head = head.next

cur.next = pre

pre = cur

이런 느낌으로 쭉 돌리고 마지막 노드를 반환하면
[5, 4, 3, 2, 1]로 출력 된다
어려웠는데 그림으로 그려서 생각해보니 이해가 잘 되었다