leetle

Daily challenge for 2026-10-14

652. Pair Outermost Crates

You are given a list of crate weights. You must pair the outermost crates from both ends of the list, moving inwards, and return a new list containing the sum of each pair. If the list has an odd number of crates, the middle crate's weight is added as the final element in the result without being paired.

Constraints:
There are 0–1,000 crate weights. Every weight is a non-negative integer at most 1,000,000. An empty list returns an empty list.

Example:
Input: weights = [10, 20, 30, 40, 50]
Output: [60, 60, 30]

Run this challenge interactively in Python or JavaScript when the app loads.