Tap here to switch tabs
Problem
Submissions

Problem: Path With Minimum Effort

med
30 min
Try to solve the Path With Minimum Effort problem.

Statement

You are given a 22D array heights of size rows $ imes$ columns, where heights[row][col] represents the height of the cell at coordinate (row, col).

You are currently positioned at the top left cell (0,0)(0, 0) and wish to travel to the bottom right cell (extrows−1,extcolumns−1)( ext{rows} - 1, ext{columns} - 1). You can move up, down, left, or right to adjacent cells.

A route’s effort is defined as the maximum absolute difference in heights between two consecutive cells along the path.

Return the minimum effort required to travel from the top left cell to the bottom right cell.

Constraints:

  • rows ==== heights.length

  • columns ==== heights[i].length

  • 1≤1 \leq rows, columns ≤100\leq 100

  • 1≤1 \leq heights[i][j] ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Path With Minimum Effort

med
30 min
Try to solve the Path With Minimum Effort problem.

Statement

You are given a 22D array heights of size rows $ imes$ columns, where heights[row][col] represents the height of the cell at coordinate (row, col).

You are currently positioned at the top left cell (0,0)(0, 0) and wish to travel to the bottom right cell (extrows−1,extcolumns−1)( ext{rows} - 1, ext{columns} - 1). You can move up, down, left, or right to adjacent cells.

A route’s effort is defined as the maximum absolute difference in heights between two consecutive cells along the path.

Return the minimum effort required to travel from the top left cell to the bottom right cell.

Constraints:

  • rows ==== heights.length

  • columns ==== heights[i].length

  • 1≤1 \leq rows, columns ≤100\leq 100

  • 1≤1 \leq heights[i][j] ≤106\leq 10^6