Practice · 2 of 3
Stone Merging
CHALLENGE
Difficulty: advanced+25 XP
**Problem.** Line 1: n. Line 2: n pile sizes in row order. Merging two ADJACENT piles costs their total; print the minimum total cost to end with one pile. **Constraints:** 1 ≤ n ≤ 500; 1 ≤ a[i] ≤ 10^6. Adjacent-only merging forbids the easy greedy — order matters.
Press Submit to check your solution.
Back to lesson: Practice: Interval Trio