As reported: Goldman Sachs Associate CoderPad round (1 hour, 2025): Minimum Path Sum, with a medium hash-map question.
Given an m × n grid of non-negative numbers, find a path from the top-left to the bottom-right cell, moving only right or down, that minimises the sum of the numbers on it. Return that sum.
This is LeetCode 64 — Minimum Path Sum.
Example 1
grid = [[1,3,1],[1,5,1],[4,2,1]]
-> 7
Example 2
grid = [[1,2,3],[4,5,6]]
-> 12
Constraints: 1 ≤ m, n ≤ 200; 0 ≤ grid[i][j] ≤ 200.
Code runner format: one JSON value per line: grid (LeetCode's test-case format). Implement minPathSum(grid); the harness prints the result as JSON.