Company: Godaddy_27aug
Difficulty: easy
Drone Descent Over the City A delivery drone flies down through a vertical slice of a city that is divided into a 4 x 4 grid of sectors. city[i][j] is the power cost of flying through the sector in row i and column j : wind, obstacles and elevation all make a sector more expensive. Every time the drone passes through sector (i, j) its power drops by city[i][j] units. The descent works like this. The drone enters the grid at any sector of the first row (row 0 ), paying that sector's cost. From a sector (i, j) it always drops one row, moving to (i + 1, j - 1) , (i + 1, j) or (i + 1, j + 1) -- straight down, or one step diagonally to either side -- and pays the cost of the sector it arrives in. A move that would leave the grid sideways is not allowed. The descent ends as soon as the drone reaches the last row (row 3 ). The drone starts with 100 units of power. Its power is simply reduced by the cost of every sector it flies through, and it is allowed to keep flying even if that drives its