FastPrepFuel-Aware Grid Reachability
Problems/Fuel-Aware Grid Reachability

Fuel-Aware Grid Reachability

Bloomberg LP logoBloomberg LP● MediumNEW GRADINTERNFULLTIMEPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Bloomberg onsite interview for new grad and intern roles. The report gives a grid with ground, obstacles, fuel, a start, and a destination. It leaves out how much fuel there is and how refills work. We chose those. Our version is about 86% the same as the reported question.

You have a tank whose capacity is fuelCapacity. It starts full. The rectangular grid contains exactly one start cell S, exactly one target cell T, open ground ., blocked cells #, and fuel cells G.

You may move one cell up, down, left, or right. Each move consumes one unit of fuel, so you may leave a cell only when at least one unit remains. You cannot enter a blocked cell. Entering a fuel cell immediately restores the tank to fuelCapacity; a fuel cell may refill the tank again on a later visit.

Return true if you can reach T, and return false otherwise. Reaching T with zero fuel remaining is allowed.

Function

canReachWithFuel(grid: String[], fuelCapacity: int) → boolean

Examples

Example 1

grid = ["S..",".#G","...","..T"]fuelCapacity = 4return = true
grid
0120S..1.#G2...3..T

The start-to-target distance exceeds four moves, but the path can reach G in three moves, refill to four units, and then reach T.

Example 2

grid = ["S#T","..."]fuelCapacity = 3return = false
grid
0120S#T1...

The obstacle forces a four-move detour, and there is no fuel cell to extend the initial three units.

Example 3

grid = ["SGT"]fuelCapacity = 1return = true
grid
0120SGT

The first move spends the only fuel unit, entering G restores it, and the second move reaches T.

Constraints

  • 1 <= grid.length <= 200.
  • 1 <= grid[i].length <= 200, and all rows have the same length.
  • 0 <= fuelCapacity <= 400.
  • Every cell is one of S, T, ., #, or G.
  • The grid contains exactly one S and exactly one T.

More Bloomberg LP Onsite Interview questions

  • 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
  • Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Number of IslandsFleetx · ONSITE INTERVIEW
  • Matrix EscapeByteDance · PHONE SCREENByteDance interview questions
  • Minimum Time to Spread Through a GridAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Number of IslandsIntuit · ONSITE INTERVIEWIntuit interview questions
  • Rotting OrangesSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Max Area of Island Without Changing the GridFlexport · PHONE SCREENFlexport interview questions
  • Minimum Time to Rot All OrangesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Reachable Exits in an Obstacle GridWhatNot · PHONE SCREENWhatNot interview questions
  • Number of Islands with Diagonal ConnectivityGoogle · ONSITE INTERVIEWGoogle interview questions
  • Island Count and Maximum AreaOracle · ONSITE INTERVIEWOracle interview questions

Interview reports that mention this question

  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Question Bank: 161 Questions (Part 1 of 2)
  • Bloomberg New Grad Screens: 30 Experiences (Part 4 of 5)
  • Bloomberg New Grad OOD Follow-ups: 14 Experiences (Part 3 of 5)
  • Bloomberg New Grad SWE Interviews: 98 Experiences (Part 1 of 5)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public boolean canReachWithFuel(String[] grid, int fuelCapacity) {
        // Write your code here.
    }

}
Checking account…