A robot vacuum game shows a floor plan grid as an array of strings. S is the start, E is the charging dock, . is open floor, and # is furniture. The robot moves up, down, left, or right.
Write countFullCleans(grid) that returns how many different routes go from S to E while stepping on every tile that isn't furniture exactly once (including S and E). The route must end when it reaches E.
Input: grid = ["SE"] Output: 1
Step from S straight onto E; both tiles are covered.
Input: grid = ["S.","E."] Output: 1
The only full route is right, down, left: S, the top-right tile, the bottom-right tile, then E.
1 <= grid.length * grid[0].length <= 20S and one E.Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #313 Cover Every Open Tile. 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.