linked list1 LeetCode. Reverse Linked List [Linked List] Problem: Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL -Summary- 1. Keep track of current / prev (copy the original list in the curr and prev) 2. Update and move the head (original) 3. Return prev -Other iterative solution- # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = .. 2020. 6. 3. 이전 1 다음