As reported: PayPal Senior Software Engineer Frontend, DSA round (2025, 45 minutes): LeetCode Triangle, full working solution run against hidden tests.
Given a triangle array (row i has i + 1 numbers), return the minimum path sum from top to bottom. From index j on one row you may move to index j or j + 1 on the next row.
This is LeetCode 120 — Triangle.
Example 1
triangle = [[2],[3,4],[6,5,7],[4,1,8,3]] -> 11 (2 + 3 + 5 + 1)
Example 2
triangle = [[-10]] -> -10
Constraints: 1 ≤ triangle.length ≤ 200; triangle[i].length == i + 1; -10^4 ≤ triangle[i][j] ≤ 10^4.
Code runner format: one line, the triangle as JSON. Implement minimumTotal(triangle); the harness prints the sum.
Follow-up: use only O(n) extra space, where n is the number of rows.