All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 From ab to ba (Posted on 2019-01-17)
Given a string of 2 letters ab, your task is to convert it into ba. You are allowed to add either aa or bb on either side of a current string or into the string, like ab=>abaa=>abbb=>aaabbb=>aaabaabb.
You are also allowed to erase either aa or bb any place like aaabbb=>abbb.
Is it possible? If so, how?

Comments: ( Back to comment list | You must be logged in to post comments.)
 How to do it (spoiler) | Comment 1 of 2
No, it is not possible.  Here is a "parity"-type argument.

Let all of the a's equal zero and all of the b's equal one.  Calculate the "parity" as the sum of all the odd digits minus the sum of all the even digits.

Then ab = -1 and ba = 1.

But adding or erasing aa or bb  does not change the "parity".  Therefore, the desired transformation is impossible.

 Posted by Steve Herman on 2019-01-17 12:08:16

 Search: Search body:
Forums (0)