Compute minimum path sum in a triangle
Company: TikTok
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates proficiency in dynamic programming and algorithmic problem-solving within the Coding & Algorithms domain, focusing on handling triangular data structures, index transitions, and numeric aggregation.
Constraints
- Row i has length i+1
Examples
Input: ([[2], [3, 4], [6, 5, 7], [4, 1, 8, 3]],)
Expected Output: 11
Explanation: Prompt example.
Input: ([[-10]],)
Expected Output: -10
Explanation: Single negative value.
Input: ([],)
Expected Output: 0
Explanation: Empty triangle.
Input: ([[1], [2, 3]],)
Expected Output: 3
Explanation: Two rows.
Hints
- Compute minimum suffix path sums from the bottom row upward.