A tile-based level editor stores a level as an array of strings, board, where "." is an open tile and "#" is a wall. A character starts on the top-left tile and wants to reach the bottom-right tile, moving one tile right or down at a time and never onto a wall.
Write countRoutes(board) that returns the number of different routes. If the start or the end is a wall, return 0.
Input: board = ["...",".#.","..."] Output: 2
Go around the wall in the middle: along the top and right, or along the left and bottom.
Input: board = ["..","#."] Output: 1
The only route is right, then down.
1 <= board.length, board[0].length <= 20. and #.2^31 - 1.Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #504 Routes Around Blocked Tiles. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.