Daily challenge for 2026-09-10
618. Symmetric Elevation Difference
You are given an array of integers heights representing terrain elevations along a trail. Using two pointers starting at both ends of the trail (one at index 0 and one at index n - 1), calculate the sum of absolute differences between corresponding symmetric elevation points: |heights[i] - heights[n - 1 - i]| for all i < n - 1 - i. Return the total symmetric difference sum.
Example:
Input: heights = [1, 5, 3, 8]
Output: 9
Explanation: The pairs from the ends moving inward are (1, 8) with difference |1 - 8| = 7, and (5, 3) with difference |5 - 3| = 2. Total sum is 7 + 2 = 9.
Run this challenge interactively in Python or JavaScript when the app loads.