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 »

Review Suggested Edit

You can't approve or reject suggested edits because you haven't yet earned the Edit Posts ability.

Approved.
This suggested edit was approved and applied to the post 11 months ago by WheatWizard‭.

5 / 255
Are these reduced forms of the same thing?
  • # Task
  • You are going to take three strings as input $A$, $B$ and $X$. And your goal is to determine if there exists a third string $S$ such that both $A$ and $B$ can be formed by iteratively removing contiguous substrings of $X$ from $S$. For example if $X = 10101$ then both $10$ and $01$ can be formed from the staring string $S = 1010101$
  • $$
  • 10\,\,(10101) \rightarrow 10
  • $$
  • $$
  • (10101)\,\,01 \rightarrow 01
  • $$
  • Input may be either a list of positive integers or a string of alphanumberic ascii characters. Output should be one of two distinct consistent values for each of the cases. One value should be given if an $S$ exists, and the other if not.
  • This is code-golf the goal is to minimize the size of your source code as measured in bytes.
  • # Test cases
  • ## True
  • The following cases should give a *true* value. In each I give an example $S$, but this is neither input nor output, it is just provided for demonstration.
  • ```text
  • A, B, X -> S
  • 10, 0110, 01 -> 0110
  • 10 001110, 01 -> 001110
  • 10, 01, 10101 -> 1010101
  • 1100, 0101, 10101 -> 11010101101010110101011010101
  • 102, 021, 1021021 -> 1021021021
  • 10, 01, 1010101 -> 101010101
  • ```
  • ## False
  • ```text
  • A, B, X
  • 100, 01, 10101
  • 10201, 1100, 10
  • 10, 01, 001
  • 10, 01, 1010
  • ```
  • # Task
  • You are going to take three strings as input $A$, $B$ and $X$. And your goal is to determine if there exists a third string $S$ such that both $A$ and $B$ can be formed by iteratively removing contiguous substrings of $X$ from $S$. For example if $X = 10101$ then both $10$ and $01$ can be formed from the starting string $S = 1010101$
  • $$
  • 10\,\,(10101) \rightarrow 10
  • $$
  • $$
  • (10101)\,\,01 \rightarrow 01
  • $$
  • Input may be either a list of positive integers or a string of alphanumberic ascii characters. Output should be one of two distinct consistent values for each of the cases. One value should be given if an $S$ exists, and the other if not.
  • This is code-golf. The goal is to minimize the size of your source code as measured in bytes.
  • # Test cases
  • ## True
  • The following cases should give a *true* value. In each I give an example $S$, but this is neither input nor output, it is just provided for demonstration.
  • ```text
  • A, B, X -> S
  • 10, 0110, 01 -> 0110
  • 10, 001110, 01 -> 001110
  • 10, 01, 10101 -> 1010101
  • 1100, 0101, 10101 -> 11010101101010110101011010101
  • 102, 021, 1021021 -> 1021021021
  • 10, 01, 1010101 -> 101010101
  • ```
  • ## False
  • ```text
  • A, B, X
  • 100, 01, 10101
  • 10201, 1100, 10
  • 10, 01, 001
  • 10, 01, 1010
  • ```

Suggested 11 months ago by trichoplax‭