Minimum Total Down a Triangular Bracket of Match Scores
Last updated: November 29, 2026
Quick Overview
A triangle of integers has one value in the first row, two in the second, and so on. Moving from a cell to one of the two adjacent cells in the next row, return the minimum path sum from top to bottom.
Meta
November 29, 20260
0
0 solved
A triangle of integers has one value in the first row, two in the second, and so on. Moving from a cell to one of the two adjacent cells in the next row, return the minimum path sum from top to bottom.
An easy Meta phone screen DP often used to check whether a candidate naturally goes bottom-up to avoid boundary cases. The interviewer may ask for O(n) extra space where n is the number of rows.
What the Interviewer Expects
- Notice that bottom-up removes the edge checks
- Write dp[j] = row[j] + min(dp[j], dp[j+1])
- Use O(rows) extra space
- Do not mutate the input unless allowed
- Explain why greedy fails
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Why does choosing the smaller child greedily fail?
- How would you return the path?
- How would you find the maximum path sum instead?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input is a list of rows where row i has i + 1 integers (possibly negative). From index j in row i you may move to index j or j + 1 in row i + 1. Return the minimum sum over all top-to-bo...
High-Level Design
Top-down DP works but needs special cases for the left and right edges of each row. Bottom-up is cleaner: start with dp equal to the last row. For each row above, `dp[j] = row[j] + min(dp[j], dp[j+1...