← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are driving a car across a 2-D desert grid that contains empty cells, gas stations, and exactly one oasis. Each move from your current cell to an adjacent cell (up, down, left, right) consumes one unit of gas. When you drive onto a gas-station cell you instantly refill your tank to its maximum capacity (the value given as gas_stations[i][j]). Starting from the car’s initial position with an initial amount of gas, determine whether there exists any sequence of moves that lets you reach the oasis. Return true if the oasis is reachable, otherwise return false.