Skip to content

Commit b0525be

Browse files
[N-0] refactor 554
1 parent 7706828 commit b0525be

File tree

1 file changed

+12
-7
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+12
-7
lines changed

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

+12-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
import java.util.Map;
66

77
/**
8-
* There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. You want to draw a vertical line from the top to the bottom and cross the least bricks.
9-
10-
The brick wall is represented by a list of rows. Each row is a list of integers representing the width of each brick in this row from left to right.
11-
12-
If your line go through the edge of a brick, then the brick is not considered as crossed. You need to find out how to draw the line to cross the least bricks and return the number of crossed bricks.
13-
14-
You cannot draw a line just along one of the two vertical edges of the wall, in which case the line will obviously cross no bricks.
8+
* 554. Brick Wall
9+
*
10+
* There is a brick wall in front of you. The wall is rectangular and has several rows of bricks.
11+
* The bricks have the same height but different width.
12+
* You want to draw a vertical line from the top to the bottom and cross the least bricks.
13+
* The brick wall is represented by a list of rows.
14+
* Each row is a list of integers representing the width of each brick in this row from left to right.
15+
* If your line go through the edge of a brick,
16+
* then the brick is not considered as crossed.
17+
* You need to find out how to draw the line to cross the least bricks and return the number of crossed bricks.
18+
* You cannot draw a line just along one of the two vertical edges of the wall, in which case the line will obviously cross no bricks.
1519
1620
Example:
1721
Input:
@@ -21,6 +25,7 @@
2125
[2,4],
2226
[3,1,2],
2327
[1,3,1,1]]
28+
2429
Output: 2
2530
Explanation:
2631

0 commit comments

Comments
 (0)