FastPrepMaximum Grid Path Sum in Exactly N Moves
Problems/Maximum Grid Path Sum in Exactly N Moves

Maximum Grid Path Sum in Exactly N Moves

Bloomberg LP logoBloomberg LP● MediumNEW GRADONSITE INTERVIEW

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported with a concrete matrix, start coordinate, move count, and output in a first-hand Bloomberg new-grad onsite. The start contributes zero and revisits are allowed.

Start at [startRow,startCol]. Make exactly moves one-cell moves up, down, left, or right without leaving the grid. The start contributes zero; each entered cell contributes its value. Revisiting is allowed.

Return the maximum achievable sum.

Function

maximumPathSum(grid: int[][], startRow: int, startCol: int, moves: int) → int

Examples

Example 1

grid = [[2,3,4,6],[1,2,3,5],[3,4,0,5],[0,1,2,3]]startRow = 2startCol = 2moves = 2return = 10
grid
012302346112352340530123

Move right to 5 and back or between the two adjacent 5 cells for a total of 10.

Constraints

  • The grid is nonempty and rectangular.
  • 0 <= moves <= 1000.
  • A valid move sequence exists.

More Bloomberg LP Onsite Interview questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 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
  • 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

Similar questions at other companies

  • Assign Escalations to TeamsAmazon · ONSITE INTERVIEW
  • Knight Probability in ChessboardGoldman Sachs · ONSITE INTERVIEWGoldman Sachs interview questions
  • Longest Matrix Walk with Two-Step ComparisonsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Maximum All-Ones Square Side LengthOmnissa · ONSITE INTERVIEWOmnissa interview questions
  • Enumerate Right-and-Down Matrix PathsOracle · ONSITE INTERVIEWOracle interview questions
  • Maximal Square AreaUber · ONSITE INTERVIEWUber interview questions
  • Minimum Path SumMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Maximum Grid Path ScoreDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Bomb Enemy Best CoordinatesSambaNova Systems · ONSITE INTERVIEWSambaNova Systems interview questions
  • Maximum Falling Path Sum in a RectanglePeopleStrong · ONSITE INTERVIEWPeopleStrong 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)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int maximumPathSum(int[][] grid, int startRow, int startCol, int moves) {
      // Write your code here.
    }
}
Checking account…