Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4580598
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:48:21+00:00 2026-05-21T20:48:21+00:00

Its mostly in the title, what I mean by alternating is that there is

  • 0

Its mostly in the title, what I mean by alternating is that there is a single 1 or 0 between two occurrences of 0’s. So no such occurrences of 010 or 000.

I am trying to understand the theoretical nature of the question so I would prefer the answer in terms of just Concatenation, Union, and Closure (10, 1|0, and 10*).

Please note this is NOT a homework question I am just interested in the question, so please no patronizing comments to that affect.

Edit: changed the wording in the first paragraph from “between the occurrences” to “between two occurrences”.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T20:48:22+00:00Added an answer on May 21, 2026 at 8:48 pm

    The first important observation is that we can reduce the problem: if S is allowed and is 1 or ends with two ones, S concatenated with any allowed sequence remains allowed. So what makes a valid S?

    1. 1 is explicitly in S, and any sequence of more than one 1 will always end in 11 and so is in S.
    2. A 01 may only be followed by another 1, as a 0 would give 010. This ends in 11, and so is a valid S.
    3. A 00 may only be followed by 11, as 0000, 0001 and 0010 all have alternating zeros. This ends in 11, and so is a valid S.

    So that tells us any S matches ^(1|011|0011)*$. But we’re not done, as there are a few other sequences that are not valid for S but are themselves allowed sequences and so could be concatenated to an S.

    • 0
    • 00
    • 01
    • 001

    000 is not allowed, of course, and anything longer is either in S or is itself not allowed.

    So the entire regex matching allowed sequences is:

    ^(1|011|0011)*(|0|00|01|001)$
    

    That is zero or more S sequences, optionally followed by one of our allowed non-S sequences.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a safari extenstion (mostly for learning purposes) that creates a
I know there are a lot of topics with the same title. But mostly
I'm using jQuery Mobile and its mostly good. Although there are a few errors.
I use T4MVC inside my asp mvc projects, mostly because it's brilliant. Is there
Its so happening that my actual data is 1/4 that of the HTTP request
Doing some R&D for my company. We are trying to have a listView that
I've developed a simple webflow in Grails (mostly to experiment with using webflows- its
Using the jQuery plugin http://jquery.com/plugins/project/jquerylightbox_bal Is there a way to have the title and
I know there are a few questions about similar topics but they mostly amount
Title says it mostly. I want to add a simple extension method to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.