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 146965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:41:50+00:00 2026-05-11T08:41:50+00:00

Let’s take a concrete example and hope I can be clear. Suppose the (ordered)

  • 0

Let’s take a concrete example and hope I can be clear. Suppose the (ordered) list of months:

January < February < March < … < December

(with integers that stand for the months, zero-based), such that

Jan is 0, Feb is 1, …, Dec is 11.

Now suppose I do not have access to the full names of months, and am given the following list, where months have been shortened to their first letter, and e stands for an empty category, like this:

e, F, e, e, e

If I build a list of ‘unambiguous months’ (f:1, s:8, o:9, n:10, d:11), I can fill the empty categories by by first calculating the first category (using subtraction and mod 12), and then write the rest from there. However, suppose I am given the list

e, A, e, e, J, e

Then I can (intuitively) calculate that although A is ambiguous (could be April or August), in this context it can only be April, since August does not have any Js following it after 2 categories. Once I find this, I can again calculate everything from the start.

My question, finally, is: is there an analytic solution (function, algorithm) for this problem, or is my only hope to use brute force to define each potential relation? For some examples, no disambiguation algorithm/function can work: consider the case where I have a J followed by 11 e‘s, followed by a J followed by 11 e‘s … Since there is a year in between, I cannot disambiguate J into January, June or July.

Answer: I ended up coding Il-Bhima’s answer, because for this case in particular, regex’s are ok, even at a higher running time O(mn). However, I accepted Ben’s answer as the correct answer because it subsumes the others (mentions the regex solution), but also suggests a better way by using the KMP algorithm O(m+n), although this is for larger numbers of the string against to match the pattern. Thanks, everybody.

  • 1 1 Answer
  • 0 Views
  • 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. 2026-05-11T08:41:51+00:00Added an answer on May 11, 2026 at 8:41 am

    I’m not sure if this is exactly what you’re looking for, but you could use a modified KMP string search algorithm to solve this problem.

    The modification would be to match anything against the empty category. It could even find all possible values for you, such as the J with 11 e’s like you mentioned.

    You could also use a finite state machine to determine possibilities, this is what a regular expression would do.

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

Sidebar

Ask A Question

Stats

  • Questions 213k
  • Answers 213k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer They have to be unique for the table or view… May 12, 2026 at 10:34 pm
  • Editorial Team
    Editorial Team added an answer *items means that the function accepts variable number of arguments.… May 12, 2026 at 10:34 pm
  • Editorial Team
    Editorial Team added an answer There is one issue. The cookies are encrypted and validated… May 12, 2026 at 10:34 pm

Related Questions

I have a French site that I want to parse, but am running into
Let's say you create a wizard in an HTML form. One button goes back,
Let's say I'm building a data access layer for an application. Typically I have
Let's say you have a class called Customer, which contains the following fields: UserName
Let me try to explain what I need. I have a server that is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.