EugenDu
BAN USER
Questions (1)
Comments (9)
Reputation 120
- 2of 2 votes
AnswersProblem: you are given 2 words with equal number of characters. Find an algorithm to go from first word to second word, changing one character at each step, in such a way that each intermediate word exist in a given dictionary.
- EugenDu in United States
Example:
Words are pit, map. A possible solution:
pit, pot, pet, met, mat, map| Report Duplicate | Flag | PURGE
Ebay Software Engineer in Test Algorithm
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
I think the problem needs some clarification - if there are 2 or more elements with the biggest frequency do you need to return them all or any? Do you need to return the element(s) or just the frequency? If you just need to return the frequency, an in order traversal, and keep track of the highest frequency at any given step would be enough and would be O(N) time, O(1) memory.
- EugenDu May 28, 2013Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
The exit condition is problematic - if some guys are on their floor, you don't exit.
- EugenDu May 31, 2013