Minimum Path Sum
Updated
Problem statement
Given a nonempty rectangular matrix grid of nonnegative integers, start at the top-left cell and reach the bottom-right cell.
At each step, move exactly one cell right or one cell down. Return the minimum possible sum of the values on the path, including both endpoints.
Function
minimumPathSum(grid: int[][]) → intExamples
Example 1
grid = [[1,3,1],[1,5,1],[4,2,1]]return = 7The path 1, 3, 1, 1, 1 has sum 7.
Example 2
grid = [[1,2,3],[4,5,6]]return = 12Moving right, right, then down gives 1 + 2 + 3 + 6.
Example 3
grid = [[1,99,1],[1,99,1],[1,1,1]]return = 5Advanced contract case 7.
Constraints
1 <= grid.length, grid[0].length <= 500- Every row has the same length.
0 <= grid[r][c] <= 10000- The answer fits in a signed 32-bit integer.
More Bloomberg LP Onsite Interview questions
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- Currency Conversion RatePHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Maximal SquareAmazon · ONSITE INTERVIEW
- Find Robots by Blocker DistancesUber · PHONE SCREENUber interview questions
- Factory Cost — Minimum Cost Across StagesStripe · PHONE SCREENStripe interview questions
- Maximum All-Ones Square Side LengthOmnissa · ONSITE INTERVIEWOmnissa interview questions
- Maximum Rocks on a North-or-East Grid PathGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
- Maximal SquareAirwallex · PHONE SCREENAirwallex interview questions
- Maximal SquareSalesforce · PHONE SCREENSalesforce interview questions
- Minimum Path SumMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Maximum Falling Path SumIMC Trading · PHONE SCREENIMC Trading interview questions
- Grid Paths Around Blocked CellsAdobe · PHONE SCREENAdobe interview questions
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)