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

Home > Logic
From ab to ba (Posted on 2019-01-17) Difficulty: 3 of 5
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?

No Solution Yet Submitted by Ady TZIDON    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution? Comment 2 of 2 |
Unless my reasoning is wrong, the task is impossible.

There will always be an a somewhere to the left of a b.

Adding aa or bb cannot change this.  

Removing aa or bb from the end cannot change this.  You can't really remove the original b without first adding in a bb on its side.  So you still have a b on the right side.

Removing aa or bb from the middle can only really remove an aa or bb that was previously added.



  Posted by Jer on 2019-01-17 12:10:50
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (1)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2020 by Animus Pactum Consulting. All rights reserved. Privacy Information