LearnPy Hub
← Arena
AdvancedRating 1700

Break the Fewest Walls

Walk from the top-left to the bottom-right cell, moving up, down, left or right. Cells marked # are walls; you may break through walls. Print the fewest walls you must break.

Input

r and c, then r rows of . and #.

Output

One integer.

Sample 1

Input
3 3
.#.
##.
.#.
Output
1

Sample 2

Input
1 1
.
Output
0
solution.py
Output appears here
Break the Fewest Walls · Python Arena problem · LearnPy Hub