Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Prove commutativity on this monoid presentation.

+2
−0

Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ from $S$.

For example for $A=100$ and $B = 010$, one solution is $S = 10101010$ since

$$ (10101)010 \rightarrow 010 $$$$ 10(10101)0 \rightarrow 100 $$

For a more complex example if $A = 1100$ and $B = 0101$, then one solution is $S = 11010101010101$ since

$$ 110(10101)010101 \rightarrow 1100(10101) \rightarrow 1100 $$$$ 1(10101)01010101 \rightarrow (10101)0101 \rightarrow 0101 $$

There are multiple solutions to every possible input, but there is no requirement that the output be any particular one, only that it satisfy the requirements.

This is code-golf, the goal is to minimize the size of your source code as measured in bytes.

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

0 answers

Sign up to answer this question »