Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
hackercup / 2021 /round1 /weak_typing_ch1_sol.md
wjomlex's picture
2021 Problems
d3f4f72 verified

The letter "F" may always be typed, whichever hand is being used. Therefore, occurrences of "F" in (W) have no bearing on which hand Timmy chooses to use, and may be ignored.

This leaves us with a reduced string (W') of relevant letters, each being either "X" (only typeable with Timmy's left hand) or "O" (only typeable with his right hand). Whenever a "X" is followed by an "O" in (W'), Timmy must switch from his left hand to his right, and vice versa whenever an "O" is followed by a "X". Therefore, (F(W)) is equal to the number of pairs of consecutive differing letters in (W').

See David Harmeyer's solution video here.