처음엔 그냥 리스트를 pop으로 다시 담으면 된다고생각함..
그런데 주어진건 head였음!!
--> node가 있는
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseList(self, head: ListNode) -> ListNode:
prev, curr = None, head
while curr:
temp = curr.next
curr.next = prev
prev = curr
curr = temp
return prev