Collect Coins With Tokens
Asked at Google
Reported by the problem's creator, not verified
A board is a string of cells. A . is an empty cell, a T holds a token, and a C holds a coin.
Implement max_coins.
Examples
Example 1
Input: board =
T..C..C..Output:
2Explanation: The token moves from index 0 to 3 and collects that coin, then from 3 to 6 for the second one.
Example 2
Input: board =
T.C...T.COutput:
0Explanation: The token at index 0 can only land on indices 0, 3 and 6, and the token at index 6 cannot move (index 9 is off the board). The coins at indices 2 and 8 sit on cells no token ever lands on.
Import your own questions
Paste a question you were asked and get a full problem: statement, tests and a checked solution.