Let's play a game! Given a string of X's and O's, you can
What is the fewest number of steps needed to change the string OOX into OXOOOX?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Steps 1. and 3. increase the length of a string by one character and step 2. decreases the length of a string by one character. So to go from a string of length 3 to one of length 6 we must use steps 1. and 3. a total of n ≥ 3 times and step 2. a total of n − 3 times for a total of 2 n − 3 steps, which, being odd, rules out 4 and 6 as possible choices.
Now although 3 is not an answer option, we should first, in the interest of completeness, rule it out as the actual minimum. To increase the length of a string by 3 characters in 3 steps would mean that we can only use steps 1. and 3.. Given this restriction, the only way to increase the number of O 's by two and the number of X 's by one would be to employ step 1. twice and step 3. once. But none of the three possible such sequences of steps would result in a string beginning with " O X ", and so the desired transformation cannot be achieved in 3 steps.
To achieve the transformation in 5 steps, one possible sequence is to apply step 3. three times to get X X X O O X , then apply step 1. to get X X X O O O X . From here we apply step 2. to end up with O X O O O X , the desired string.