Skip to content

Commit 739912b

Browse files
refactor 675
1 parent d97086d commit 739912b

File tree

1 file changed

+0
-51
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-51
lines changed

src/main/java/com/fishercoder/solutions/_675.java

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,6 @@
55
import java.util.PriorityQueue;
66
import java.util.Queue;
77

8-
/**
9-
* 675. Cut Off Trees for Golf Event
10-
*
11-
* You are asked to cut off trees in a forest for a golf event.
12-
* The forest is represented as a non-negative 2D map, in this map:
13-
* 0 represents the obstacle can't be reached.
14-
* 1 represents the ground can be walked through.
15-
*
16-
* The place with number bigger than 1 represents a tree can be walked through,
17-
* and this positive number represents the tree's height.
18-
*
19-
* You are asked to cut off all the trees in this forest in the order of tree's height -
20-
* always cut off the tree with lowest height first.
21-
* And after cutting, the original place has the tree will become a grass (value 1).
22-
*
23-
* You will start from the point (0, 0) and you should output the minimum steps you need to walk to cut off all the trees.
24-
*
25-
* If you can't cut off all the trees, output -1 in that situation.
26-
* You are guaranteed that no two trees have the same height and there is at least one tree needs to be cut off.
27-
*
28-
* Example 1:
29-
* Input:
30-
* [
31-
* [1,2,3],
32-
* [0,0,4],
33-
* [7,6,5]
34-
* ]
35-
* Output: 6
36-
*
37-
* Example 2:
38-
* Input:
39-
* [
40-
* [1,2,3],
41-
* [0,0,0],
42-
* [7,6,5]
43-
* ]
44-
* Output: -1
45-
*
46-
* Example 3:
47-
* Input:
48-
* [
49-
* [2,3,4],
50-
* [0,0,5],
51-
* [8,7,6]
52-
* ]
53-
* Output: 6
54-
*
55-
* Explanation: You started from the point (0,0) and you can cut off the tree in (0,0) directly without walking.
56-
* Hint: size of the given matrix will not exceed 50x50.
57-
*/
58-
598
public class _675 {
609
public static class Solution1 {
6110
public int cutOffTree(List<List<Integer>> forest) {

0 commit comments

Comments
 (0)