sunshihaosd
BAN USER
Questions (3)
Comments (1)
Reputation 205
- 1of 1 vote
AnswersUse the shorest unique prefix to represent each word in the array
- sunshihaosd in United States
input: ["zebra", "dog", "duck",”dot”]
output: {zebra: z, dog: do, duck: du}
[zebra, dog, duck, dove]
{zebra:z, dog: dog, duck: du, dove: dov}
[bearcat, bear]
{bearcat: bearc, bear: ""}| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm - 1of 1 vote
Answerdef inc:
- sunshihaosd in United States
while True:
v = v + 1 //---A
set(s) // ---B
def disp:
while True:
wait(s) //---C
print v //----D
print all possible value, which is shared value. At the begin , v = 0
s is binary semophore. initial value is 0| Report Duplicate | Flag | PURGE
Google SDE1 Algorithm
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
I don't quite understand how to use two heaps to find the midian. Can you explain in detail for me? thank you
- sunshihaosd February 17, 2013