MediumRating 1656
2130. Maximum Twin Sum of a Linked List
linked-listtwo-pointersstack
解題說明
C++ 解法
複雜度分析
虛擬碼
1. Find middle node using slow/fast pointers 2. Reverse the second half of the list starting from slow 3. Set left = head, right = head of reversed second half 4. While right != null: a. ans = max(ans, left.val + right.val) b. left = left.next, right = right.next 5. Return ans