Editorial for Canada Day Contest 2021 - Bob and Canada
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Hint
In order to make a string Canadian, you need to change all the W
s in the red sections and the R
s in the white section.
Hint
Try to come up with a formula for the number of edits based on the starting point of the second and third section.
Solution
Let's say the first section (red) goes from index
Time complexity:
There are quite a few other accepted solutions so feel free to show your own in the comments.
Comments