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
Coding & Algorithms
Software Engineer
Meta
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

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
Dynamic programming
Bottom-up DP
Triangle path
Space optimization
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported