Maximum Twin Sum of a Linked List

Medium · Linked Lists · about 15 minutes

Asked at Amazon, Google, Microsoft, Meta.

The list has an even number of nodes n. Pair the node at position i (from 0) with the node at position n - 1 - i: first with last, second with second-to-last, and so on. Add up each pair's values and return the largest pair total.

Related guides