Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Minimum Effort Grid Path

HardPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Minimum Effort Grid Path. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Given a grid of heights, return the minimum possible effort needed to move from the top-left cell to the bottom-right cell. The effort of a path is the maximum absolute difference between adjacent cells along that path, and movement is allowed in four directions.

Constraints

  • 1 <= m, n <= 100
  • 1 <= heights[i][j] <= 10^6
  • Move only up, down, left, or right
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output