dsa1 min read
Swapping Nodes in a Linked List — Find Kth from Front and Back
Swap the kth node from the front with the kth node from the end by finding both with two pointers.
Read →
webcoderspeed.com
1276 articles
Swap the kth node from the front with the kth node from the end by finding both with two pointers.
Remove consecutive nodes that sum to zero by tracking prefix sums in a map and relinking past zero-sum runs.
Split a linked list into k consecutive parts as evenly as possible, front parts get the extra nodes.
Reverse the portion of a linked list between positions left and right in one pass using careful pointer manipulation.
Find the maximum sum of twin nodes (node i + node n-1-i) by reversing the second half and comparing pairs.