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

  • Home
  • SEARCH
  • 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 8844903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:36:13+00:00 2026-06-14T11:36:13+00:00

My college is getting over so I have started preparing for the interviews to

  • 0

My college is getting over so I have started preparing for the interviews to get the JOB and I came across this interview question while I was preparing for the interview

  1. You have a set of 10000 ascii strings (loaded from a file)
  2. A string is input from stdin.
  3. Write a pseudocode that returns (to stdout) a subset of strings in (1) that contain the same distinct characters (regardless of order) as
    input in (2). Optimize for time.
  4. Assume that this function will need to be invoked repeatedly. Initializing the string array once and storing in memory is okay .
    Please avoid solutions that require looping through all 10000 strings.

Can anyone provide me a general pseudocode/algorithm kind of thing how to solve this problem? I am scratching my head thinking about the solution. I am mostly familiar with Java.

  • 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-14T11:36:15+00:00Added an answer on June 14, 2026 at 11:36 am

    Here is an O(1) algorithm!

    Initialization:

    • For each string, sort characters, removing duplicates – eg “trees” becomes “erst”
    • load sorted word into a trie tree using the sorted characters, adding a reference to the original word to the list of words stored at the each node traversed

    Search:

    • sort input string same as initialization for source strings
    • follow source string trie using the characters, at the end node, return all words referenced there
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My college course just started going over mongodb and we have an assignment to
I'm getting a bit confused with this homework i have to do for college,
Ever since getting out of college (06) I have primarily worked with java and
Today in my college a teacher asked me a question. He wrote this code
I have this program which worked find in my college lab, but when I
I am getting ready to take a class at a college on C#. I
I have a college project where I need to extend an existing spreadsheet application
I hope this question takes a simple fix, and I am just missing something
I am a college student getting my Computer Science degree. A lot of my
I have an SQL final exam in college in a few days and I

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.