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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:24:10+00:00 2026-06-03T04:24:10+00:00

I wan to build an algorithm which able to give the overlapping indices of

  • 0

I wan to build an algorithm which able to give the overlapping indices of the elements found in the two arrays.

e.g. I have two arrays of string

Array1: {“a”,”c”,”h”,“d”,”a”,”o”,”m”}

Array2: {“d”,”a”,”o”,”m”,”c”,”e”,”o”,”m”,”c”,”z”,”e”,”l”,”p”,”v”,”c”,”z”,”c”}

It should return me the indices of the array1 and array2 in this way

x1,y1={3,6}
*x2,y2={0,3}*

It means the sequence of the string in the array should match and as long as the string values match we need to do that and make sure that every record will be unique by their previous record matching.

Waiting for the answers and responses , if questions then please let me know.

Like an example, I have a table in database where i inserting the records, and every record which i want to insert should be very unique. So at a time of insertion, we do have an array of records which needed to insert in a batch. So if i say, I do have the record in the database table is in the form:

colum1
hash1
hash2
hash3
hash4
hash5

And I want to insert a bunch of records in the database which are in the form:
hash3
hash4
hash5
hash6
hash7
hash8

Then the resultant of the table should be loook like this
colum1
hash1
hash2
hash3
hash4
hash5
hash6
hash7
hash8

But, if the array which need to be inserted in the database will be in the format like
hash2
hash3
hash4
hash6

then it should be treated as a whole new entry and will be inserted in the database as a whole.

Hope I am clear this time to elaborate my problem

  • 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. Editorial Team
    Editorial Team
    2026-06-03T04:24:12+00:00Added an answer on June 3, 2026 at 4:24 am

    The problem you’re referring to is called the Longest Common Substring problem (not to be confused with another problem about strings and an LCS acronym – longest common subsequence). As usual, the best explanation is in Wikipedia: http://en.wikipedia.org/wiki/Longest_common_substring_problem 🙂

    In short – if the strings are really short and you’re a very lazy programmer, the fastest way of doing that is to check all substrings of arr2 against arr1. This will take about n^2*m time (if arr2 if of length n, and arr1 is of length m) – which is a lot of time for long strings.

    If your strings are longer / you are less lazy, the best algorithm using suffix trees will give you linear running time.

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

Sidebar

Related Questions

I wan't to combine two lists of string, both of them have 200000+ items
I wan't a method with which to find a string within another string. It
For a project, I wan't to build a webapp, which shows (semi-) real time
in my App.xaml iv'e initialized an object which i wan't to use in different
I have a project with requirements: Clients connect to server through internet (WAN) to
I wan't to build SMS triggered app in my android. I know there's a
We build software using Hudson and Maven. We have C#, java and last, but
I wan't to add a subclass of UIViewController to a NSMutableDictionary which should be
I wan to convert a string for example 1,2,3,4,5,6 to an array of integers
As the title says, I want to have a build tool that quite much

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.