Search
⌘K

Leetcode 675. Cut Off Trees for Golf Event

Given an m x n grid with impassable cells (0), empty cells (1), and trees (>1) with distinct heights, find the minimum number of 4-directional steps starting from (0,0) to cut all trees in strictly increasing height order (cutting a tree turns its cell to 1), or return -1 if any tree is unreachable. The core challenge is computing and summing shortest-path distances between successive trees in height order (typically via repeated BFS/A*).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.