This question evaluates proficiency in discrete optimization and state-space reasoning, emphasizing movement constraints, collision avoidance, modular-position effects from fixed-step moves (+3), and maximizing reward collection.
You are given a 1D board represented by a string s of length n (1 <= n <= 100). Each character is one of:
'.'
: empty cell
'C'
: a cell containing one coin
'T'
: a cell containing a token (there may be multiple tokens)
Movement rules:
i
to index
i + 3
.
Task: Compute the maximum number of coins the player can collect by choosing an optimal sequence of token moves.
Output: an integer, the maximum collectible coins.
Notes/clarifications:
s
.