Question d'entretien d'embauche Northrop Grumman: Describe an algorithm that wi... | Glassdoor.fr

## Question d'entretien d'embauche

Entretien de Software Engineer(Internship) Oklahoma City, OK (États-Unis)

# Describe an algorithm that will take in a large input of

English words that may contain duplicate. Then return only unique words from the input.
Répondre

## Réponse de l'entretien

7 réponses

3

Put the items in a hash map, then return the hash map. Since hashmap eliminates duplicates.

Candidat à l'entretien, le 3 déc. 2018
1

I was interviewed today and they asked this question, so you can probably expect it!

My solution was to use a linked list to store the words, and with every new word you would conduct a linear search and discard it if it was a duplicate. Horribly inefficient and I am pinching myself for not remember my hashtables :(

John Doe, le 20 févr. 2019
1

Use a set since they don't allow for duplicates and have arbitrary order. Implement the set using a hashtable for constant time checks to see if the word is already in it.

Utilisateur anonyme, le 7 avr. 2019
1

Hey guys I used rooftop slushie to get an answer for this interview at Northrop Grumman. You should give it a try.

https://wwww.rooftopslushie.com

Utilisateur anonyme, le 11 juil. 2019
0

Sort the array, and then loop through each loop. This should result in a O(n) + O(n) vs O(n^2)

Utilisateur anonyme, le 23 sept. 2019
0

In python you could do this with

Def interview(x):
#[str] -&gt; [str]
Return set(x)

Could also use collections.Counter
Then loop through key value pairs

Utilisateur anonyme, le 24 sept. 2019
0

C#, put them into a SortedSet. It will only show the distinct ones.

Trent Nguyen, le 6 nov. 2019

## Ajouter des réponses ou des commentaires

Pour commenter ceci, se connecter ou s'inscrire