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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:55:49+00:00 2026-06-12T09:55:49+00:00

I had an interview question along these lines: Given two lists of unordered customers,

  • 0

I had an interview question along these lines:

Given two lists of unordered customers, return a list of the intersection of the two lists. That is, return a list of the customers that appear in both lists.

Some things I established:

  • Assume each customer has a unique name
  • If the name is the same in both lists, it’s the same customer
  • The names are of the form first name last name
  • There’s no trickery of II’s, Jr’s, weird characters, etc.

I think the point was to find an efficient algorithm/use of data structures to do this as efficiently as possible.

My progress went like this:

  • Read one list in to memory, then read the other list one item at a time to see if there is a match
  • Alphabetize both lists then start at the top of one list and see if each item appears in the other list
  • Put both lists into ordered lists, then use the shorter list to check item by item (that way, it one list has 2 items, you only check those 2 items)
  • Put one list into a hash, and check for the existence of keys from the other list

The interviewer kept asking, “What next?”, so I assume I’m missing something else.

Any other tricks to do this efficiently?

Side note, this question was in python, and I just read about sets, which seem to do this as efficiently as possible. Any idea what the data structure/algorithm of sets is?

  • 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-12T09:55:50+00:00Added an answer on June 12, 2026 at 9:55 am
    1. Put one list into a bloom filter and use that to filter the second list.
    2. Put the filtered second list into a bloom filter and use that to filter the first list.
    3. Sort the two lists and find the intersection by one of the methods above.

    The benefit of this approach (besides letting you use a semi-obscure data structure correctly in an interview) is that it doesn’t require any O(n) storage until after you have (with high probability) reduced the problem size.


    The interviewer kept asking, “What next?”, so I assume I’m missing something else.

    Maybe they would just keep asking that until you run out of answers.


    http://code.google.com/p/python-bloom-filter/ is a python implementation of bloom filters.

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

Sidebar

Related Questions

I had an interview and a question that seems really simple was not clicking
I was asked the following question during phone interview I had: Given the following
I had an interview question that asked me for my 'feedback' on a piece
I had an interview question asking this: text file has following lines> 1: A
I have an interview question that I can't seem to figure out. Given an
Two days ago i attended an interview.I had been asked a question and i
I was asked this question in an interview. If you had two numbers represented
I had an interview question that asked how I would design a system to
In a interview,i had been asked to a question that, Can we create WPF
I had heard this question from my friend who attended an interview recently: Given

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.