Bloomberg L.P. Interview Question: Given some random letters , f... | Glassdoor

Interview Question

Financial Software Developer Intern Interview(Student Candidate)

Given some random letters , for example

  "a,e,o,g,z,k,l,j,w,n" and a dictionary. Try to find a word in the dictionary that has most letters given.

Interview Answer

1 Answer


Take the first word, store it in a temporary string, count the number of times each of those letters appears, store it in a temporary count; continue to next word, if the count > temporary count, switch the temporary string to the new word and update the temporary count. O(nd) - n is the number of words in the dictionary, d is the average length of a word in the dictionary.

Anonymous on Oct 1, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.