My Interview with Yahoo-Inc! (Part 1)

Hello Friends,

Last month I was interviewed by Yahoo-Inc! for a job as software engineer. Here I would like to point out the discussions and various question/answer sessions I went through before I got my confirmation letter 🙂 Probably someone looking to join yahoo can take some tips from here.

In total I went through 7 rounds of interview (1 telephonic, 1 HR, 1 with Manager, 3 technical, 1 general aptitude). I will try my best to recall and summarize all of them for you all. But before I go ahead, I would like to thank my good friend Rajib Das for forwarding my resume in Yahoo and providing me with an opportunity to have a crack at it. Here I go:

  • Telephonic Interview: As it happens with all multinational firms, you go through a telephonic screening before you are actually called for a face-to-face interview. One good thing which happened for me even before the interview started was that, the interviewer already went through my CV thoroughly before interviewing me & he also checked my website Altertunes before interviewing me. You can be unlucky at times, if the interviewer comes with an open mind and try to test you in areas where you lack deep knowledge.

    My telephonic interview started early in the morning around 10 o’clock. It started with general about me questions. With my experiences I have learnt that these about me  sessions decide to a certain extent where your interview will head to. Hence, I always try to attract interviewer’s attention on my strong areas i.e. Audio Processing and web development.

    Next luckily for me he started discussing about Altertunes and various technologies used in developing the same. He specifically asked me questions like:

    1. How have you build the spell checker algorithm for Altertunes ?
    2. From where are you playing all the mp3 files ? Are they on your server ?
    3. If you have to, how will you implement the Orkut’s people connection algorithm ? i.e. If User A visits User C’s profile where User C is not a direct connection of User A, then Orkut shows a possible shortest connection. Something like this User A -> User B -> User C.
    4. What considerations have you taken while building the auto-suggest feature for Altertunes ?

    Though in my opinion a concrete answer do not exist for any of the above questions. There can be many possible solutions for every question he asked me. Here are my answers to his questions.

    1. I have used the spell checking algorithm as described by Peter Norvig, the director of research at Google in his post here. Many say, the 20 lines of code written by him in python is pure genius, and truly without any doubt it is one of the shortest and most efficient code that one can ever see. However for Altertunes, I have used a tweaked version of the same coded in PHP. For me the 20 lines code in python took 74 lines in PHP, however the results are just excellent for Altertunes. My spell checker for Altertunes gives over 90% accuracy for single word artists and over 80% accuracy for multiple word artists.
      Another simple but less accurate approach which I tried earlier was by using PHP’s inbuild function SOUNDEX, which is a phonetic algorithm for indexing names as sound, as pronounced in english. Read more about SOUNDEX here. However, the spell checker using SOUNDEX is not as accurate as the algorithm described by Peter Norvig.

    2. The answer to this question lies in one work Crawlers. I wrote crawlers in PERL which crawls the web for mp3 files and index them in the Altertunes database. However this answer didn’t satisfied the interviewer and he asked me Can you explain the architecture which you follow for developing crawlers? Probably he wanted to hear the word resolver from me, because as soon as I started telling him about resolvers he stopped me in between and proceeded to the next question. For more hint on how have I used PHP to develop web crawlers for Altertunes read here.
    3. Answer to the third question was probably hidden in the question itself. Shortest Path, is what we want hence we will obviously use one of the shortest path algorithm. As I didn’t had much knowledge on shortest path algorithms then, I suggested Dijkstra algorithm as the most appropriate for this task. However when I later discussed this problem with one of my friend, he told me probably Breath First Search (BFS) will be best suited for this problem.
    4. Here actually he asked me How have you developed the auto-suggest feature for Altertunes? For which I replied in one work AJAX. However, probably he wanted some more technical stuff on this topic and hence the next question he fired was What considerations have you taken while building the auto-suggest feature for Altertunes ? I still don’t really know what exactly was he looking for. My reply to him was, ‘I am sending each and every word typed in the input box to the server and getting response to all requests. However before sending the next request I wait for the previous response to come as I wanted my users to experience an incremental search.’

    I thought this was all that he will ask me for the telephonic interview, but ailaaa ! He started firing some questions from general algorithm and aptitude. A few questions which he further asked me were:

    • Given a tree, how will you create a mirror image of the tree? What algorithm will you use? What traversal will you prefer? 🙂
    • There is a link list, which contains a closed loop in it. How will you determine that closed loop in the link list? 🙂
    • Given a few numbers, how will you push them into a stack such that whenever I pop the top most element from that stack, I get the minimum number from the bunch. Also he wanted me to tell the pop push algorithm such that the order of insertion and popping should be O(1). 🙁
    • Given two log of wood which burns completely in 1 hour each. How will you determine 45 minutes.

    Hopefully this was all which I was asked in my telephonic interview. Within 10 minutes of the interview I received a call from the HR, asking me to come for a face-to-face interview which I scheduled for a week later. As I already got a feel of what all will be coming in the face-to-face interview, I didn’t wanted to go under prepared.

  • Face-to-Face Round 1: Before going for the in person interview, I tried my best to make myself familiar with the mother of all algorithm books by Cormen. You can download an e-copy of the same from here, size is about 10 Mb. Alternately you can search for -inurl:htm -inurl:html intitle:”index of” +(“/ebooks”|”/book”) +(chm|pdf|zip) +”cormenin google and get loads of sources for the same. You may change the search string to find other books from different formats. Anyways coming back to the interview.

    Just like my telephonic interview, the 1st round started at sharp 10 o’clock. The interviewer seemed liked a mixed bag to me. He tried to ask me questions ranging from C++, PERL, PHP, Java, Client-Server Model, Probability and even general aptitude. Here are a few questions which I can recall that were asked from me:

    1. Given a HTML page, how will you represent the same in XML format ?
    2. What are the advantages of Hidden Markov Model over other pattern recognition algorithms ?
    3. Yahoo is organizing an online programming competition and I am the head. There will be over a few million programmers participating in this contest. I have a set of 10 programming questions with me, which I give to each programmer one by one. As the programmer submits the solutions I check it, and if found perfect I give him the next question. Who-so-ever completes the 10 programming questions first is the winner. You have to award top 10 programmers. How will you go about developing such a system ? What all precautions will you take while developing such a system ? How many CPU will be required for such a system ? How will you protect the system from going down, in cases when a programmer tries to submit a virus as a solution ? etc etc
    4. Whats the probability that, my and your birthday lies on the same date and same day of the year ? (There were about 3-4 probability questions that he asked me)
    5. Draw and explain the whole client-server model ?
    6. Explain in detail, what all happens from the moment one submit a URL in the browser till the user sees the requested page on the browser?
    7. Write algorithms for Breath First Search (BFS) and Depth First Search (DFS) ? Which one is preferred over the other and why ?

    Then like the telephonic interview he fired almost the same set of questions over Altertunes. Probably there were a few more which I can’t recall at this point. Possibly the ones which I wasn’t able to reply. 😉 And that was it.

  • Face-to-Face Round 2: This was a complete session on aptitude level questions, which just kept coming one after the another. Some questions over which you can probably spend the whole day and say ‘This can be done the other way round too‘. Here are a few that I remember as of now:
    1. You have to weight all the weights between 1 and 100. Tell minimum number of weights required to do the same? (Probably the answer I gave was, weights which are a power of 2 i.e. 1,2,4,8,16,32 and 64)
    2. You have to weight all the weights between 1 and 100. Tell minimum number of weights required to do the same, however in this case you can use both pans to measure a particular weight ? For eg. If we need to weight 2 Kgs we can have 3 Kg weigh on one side and a 1 Kg + 2 Kg weight on the other side. (Probably the answer I gave was, weights which are a power of 3 i.e. 1,3,9,27…)
    3. You have a few eggs and there is a 100 level building. Determine the minimum number of attempts required to detect the floor from which, if we drop the egg it will break ? (Always consider the worst case that the egg will break at the top floor and for minimum attempts proceed from lower floor to top floor in non-uniform steps. Probably I was able to do this in 14 tries. Check if you can do the same :P)
    4. There is a huge string containing letters. Now in the string there are a lots and lots of palindromes. You need to find out the palindrome of the longest length. How will you do the same ? (Note: When I was reached the solution using stacks and queues, to complicate things he told me that a palindrome can further have a palindrome within it for eg. PALINDROMEDALADXYXDALADEMORDNILAP , hence we see the string has DALAD as a palindrome which is hidden in the full string which is a palindrome of bigger size.)
    5. There is a link list which have a lot of circular loops into it. How will you find the longest loop in the link list ?
    6. You have a very very large text file containing words. Consider that you can’t read it fully in the memory at once. How will you go about finding a word in the text file ?
    7. You have a very very large text file containing numbers. Consider that you can’t read it fully in the memory at once. How will you go about arranging the numbers in ascending or descending order ?
    8. A few questions on probability were discussed.

    There were a lot more which he asked from me. I guess there are easily 7-8 questions more that he asked from me. However this was the most interesting round that I had over the whole interview.

Probably thats enough for the first post. I will continue to write about my other rounds in upcoming posts. Till then if you have any questions or comments feel free to post them here.

  • Bhai,
    Excellent post.Keep it up.Waiting for the next post.
    Take care,
    Bye

  • Thanks a lot Avisek. Ya i will try my best to post the next part asap, else I might just forget about them.

    Anyways I am waiting for your blog updates too 🙂

  • Monabili

    Hi Bahiya!

    Congrates first of all! 🙂

    After reading your post i think i better start reading Cormen 😀 .
    Was really informative.Keep Posting!

    bye

  • Hi Monabili,

    Thanks for the wishes. Ya one needs to mug up cormen if you are looking to enter one of these biggies. They do really ask everything out of that book.

    Have a nice time on your internship 🙂

  • gg

    just discovering this blog.
    Nice articles and this one is specially instructive..
    keep going on.

  • Truly

    face 2 face: round 2

    The correct and minimum number of weights should be:

    1 2 4 8 16 32 and 37

    thus min number = 7

  • Hi truly,

    Ya the solution does still gets to 7 weights. Thats what I finally derived to. In my case the weights came out to be 1,2,4,8,16,32,64.

    As we can already make 37 by a combination of 32+4+1 = 37, hence we don’t really need 37. Probably you thought it this way that 1+2+4+8+16+32 = 63, hence the other remaining weight must be 37 to make a total of 100.

  • Parmesh

    acha post hai.
    Sahi hai oracle to yahoo.
    kafi kuch puch lete hain acha hai campus placement ho gayi nahi to aise to hona muskil tha 🙂

  • Hi Parmesh,

    Haan compared to campus placement they do ask hell lot in off campus interviews. And aabhi toh I will write another post on this. Still there are rounds left specifically on Web application servers and Trees, Data Structure and Link List.

    🙂

  • Parmesh

    chalo keep up the good work 😀

  • Truly

    haan jhantu ur right,,,,but i thought minimum weight means,,,,tht the number should be minimum and their sum total weight should also be minimum,,,,neways nice one,,,,,did u knew this answer or u calculated it,,,,coz this question i solved some years back and so i knew the answer :P/…….

  • hehe, no man I didn’t knew the answer then, he made me find it there and then itself. Actually the interviewer was nice enough to walk me through to the answer. I was on the board analyzing and from behind he just used to pop up with hints etc.

    As I said it was one of the best round I had in the interview.

  • rohit

    sahi jhantu bhaiya… too good a post! raring to read your next post

  • sekhar

    hi bhaiyya,

    wow!! that was one heck of a post …

    How cud u keep ur cool over those aptitude questions? They were really tough … and doing them in an interview is tougher, i suppose

    btw, the egg question’s ans is 7 !!! (check at midpt, if egg broke go down; else go up)

  • Hi Sekhar,

    Well thats how it was and I was just lucky enough to keep my cool and give all the answers 🙂

    Anyways about the egg question, (though i dont remember the final solution we derived) your solution was not the correct answer.

    You have suggested a kinda divide and conquer policy but the key was to think it in non-uniform steps.

  • vs

    can u work for me Abhi? 6fig $ salary, write incase

  • ChengizKhan

    Hello Abhi,

    Very nice posting. Lot of details.

    Did you ever post your Part-2 or 3. I have a face to face interview with Yahoo! coming up. That will definitely help me.

    ChengizKhan

  • Hi Chengiz,

    No I didn’t upload the other parts, basically was too lazy for that 😛

    Anyways if you want some more details you can always ask me, I will try to recall from my memories the questions asked from me.

    However the other parts were mostly on web servers and server side scripting languages. They asked me all about how to configure server, what all changes to make in the httpd.conf file of apache for various things etc etc.

  • ChengizKhan

    Hello Abhi,

    Thanks for the reply. I appreciate it. I will post couple more questions over the weekend.
    Did you have a full day interview from 10AM to 5PM?.
    I downloaded Cormen. Thanks for the suggestion. Great book. I now realize that I was asked couple of questions from it in the phone interview.

    regards
    Chengiz Khan

  • Hi,

    Ya surely, feel free to post your questions. Yes I had a full day interview, however it was from 10AM to 7PM 😉

    As I said before if you have cormen on your tips, you surely have about 40% of stuff readymade for the interview. Anyways I wrote about PHP,Perl and Apache etc in my CV and hence they asked me questions on the same. I am not sure they ask these question to everyone. They basically just look for OOPS, data structure and Algorithm knowledge.

    Welcome 🙂

  • Gengiz

    Hello Abhi,
    Can you tell me about the following a little bit.

    1)Did they ask you to write code?

    2)Did they ask any questions about Greedy algorithms/ Dynamic programming/ Binomial/Fibonnaci heaps/ disjoint sets?

    3) do you remember any questions on oops.

    4)for algorithms like palindromes, did they ask you to write code? or just provide a solutions with pseudocode

    5) how long was the aptitude kind of test with palindromes questions and such last (in time) compared to oops interview

    Thanks in advance.

    Gengiz

  • 1) Yes they did asked me to write all the codes in the world.

    2) You can’t take for granted what will be asked or what will not be. When u have 7-9 rounds, its quite possible that they can ask your ancestors name too 😉

    3) OOPS! Well yes I remember will write down later, I m in a hurry now.

    4) Yes they asked all codes. Be sure that even if you don’t write the exact code, you write down at least 50-60% of it, to give him an idea that u know the things.

    There were a few questions after which interviewer clearly told me that he wanted to see the completeness of my code.

    5) Thr were 2 rounds of about 20 – 30 min each.

    All the best.

  • Gengiz

    Hello again Abhi,
    the question you faced
    ——————————
    You have a very very large text file containing numbers. Consider that you can’t read it fully in the memory at once. How will you go about arranging the numbers in ascending or descending order ?
    ——————————–

    I would approach this by splitting the file into multiple files and sort them individually on different processors- efficiency order– O(n). Then scoop off the top line in each file and start storing them into the final file. Does this approach satisfy the problem?

    regards
    Chengiz

  • Gengiz

    Abhi,
    Thanks for the post.


  • You have a very very large text file…

    I would check these options:
    #1 Create a index of the words that that file contains
    #2 Use some indexing library e.g. Apache Lucene
    #3 Import the data in MySQL and then do SELECT ….
    #4 Read file by 4KB buffer and check for words. Some words could be partial/truncated the previous buffer could be check

  • Hey dude,
    what about part 2? I am supposed to appear in face to face round in a day or two. Looking forward to any possible help, clue or pointers.
    Thanks.

  • sorry dood but i m out on vacation with very little access to internet

    BTW all the best for your interview and if it has already happened, all the best for the results 😉

  • it got all messed up, I lost the life time opportunity 🙁

  • What happened dood? Did u gave some interview recently?

  • Hi Kumar,

    Don’t worry.
    Learn from that interview and prepare yourself for the next time.
    You can try again in 1 year maybe ?

    Slavi

  • KK

    You can’t say I use MySQL in the interview… they will ask you algorithm for select algorithm. They want to see how well you think… not how well you can use mysql…

  • KK

    And the egg problem is the binary search type…

    kya they asked probability too… I am not applying for a PhD in probability… [:)]

  • admin

    Was that for me KK? Currently toh I don’t even remember where we discussed MySQL in the interview 😛

  • KK

    BTW why is there no spam is this blog with no captcha…???

  • KK

    No… somebody told I use MySQL select to sort the text file in one of your comments…

  • admin

    Yeah they did discussed about probability too. One of the funny question asked which I can recall is, “What is the probability of my and your birthday being on the same day and date of a year”

    Funny but they did indeed discussed probability 😛

  • Hello Abhi

    That’s really good and helpful.  I did clear Yahoo! interview in Feb 2oo7 and was working in Yahoo! Bangalore for around 2 years as Sr. Web Developer for EM.  I have a list of questions,  I was asked at Yahoo! (mainly for web developer post). Please let me know your mail id so I can fwd it to you to share with others.

    All the best.

    • vidya

      hello,
      i have telephonic round for php developer. can u send me questions?

    • Sanjeev

      Plz send list of interview questions for yahoo .my mail id is [email protected]

  • Jack

    Nice post I am going to look around your site seems you have some great stuff and will be giving you a link back from my site.

  • Thomas

    Just curios…why do they ask so much from algorithms and data structures? Are these getting used on the work that you do on a daily basis?
     

  • Hehe, I know thats one of the curious question i used to had before joining Y!. It actually depends, while I was working in field of BI, algos and performance was not a priority. But with a traffic estimate of 1000+ concurrect connections on your module, you will definitely need algos/data structures in your field.

  • claws

    Where is the PART2 of this?

  • Kartik

    Hi Abhi sir,
    This is really amazing post !!
    very helpful !! looking forward for more questions !!

  • thebond23

    Hi Abhi,
    Congratulations 🙂
    It was nice article.
    I am working in a MNC, I also want to apear for yahoo interview, the questions you replied to the interviewer is almost I also knowing.
    I dont have any education degree, I do things at my end as self so wat should I do to go through the Yahoo Interview, just want to apear, will they allow me without any degree?
    plz can u suggest something to me?

  • Thiyagu

    Hi abhi,

    I am also PHP developer with 5+ years experince. I was scheduled to have interview on 15 june 2010 you post was more helpful for me to prepare.

  • nobuffer

    I am currently onto the 3rd round with yahoo. Seeing this blog, i have lost all hopes of getting ahead. All of them seem very tough to me, unless i spend 6 months doing puzzles, algos, datasturcts and know a whole lot about what is happening in the real world systems.

    I don’t have that patience or time or mind…

    Here are some questions,
    1) A guy visits his friend who is maths prof. The prof intros his three kids and asks the guy to find their ages. He gives hints, a) product of their ages is 36, sum is 1 greater than the neighbours door number, c) younger one is youngest.

    2) how will you store the population of the entire world given 1000 servers. Ofcourse efficiently.

    3) a function foo() in C returns a local pointer to a string ( for e.g. char* p = “Hello World”). What will be the value when you print out foo(). i.e. printf(“%s”, foo()); why?

    4) n connected computers identical in all ways boot up and they have to compete to become the master. how do they do it…no global clock, external storage, network latency is bad.

    5) how does the text in the search results appear. i.e. how do you find the minumum text in a doc given n keywords. a keyword can occur many times, ofcourse.

    so did i scare you off..or may be not…

  • Hemant

    Great Post.
    Keep it up.

  • vipul

    @admin
    hello sir
    it seems that getting to yahoo is very tough
    what do u think which is one of the tough interview and what tips will give to 2nd yr student of cse.
    thanX

    • Hi Vipul, This was long back in 2008…. people who interviewed me are no longer in yahoo themselves (including me), so not sure if you will get same kind of questions now….. 😉

  • vipul

    thanx for answering sir
    i ve some questions i hope u will solve.
    (1)why u left yahoo??
    (2)what tips will u give me for yahoo selection
    (3)is telephone interview there for 2011
    (4)is it true that yahoo demands extraordinary candidates.
    (5)what is working atmosphere in yahoo

  • vipul

    will u plz reply my abv questns

  • ABHISHEK PANDEY

    I Just gave an telephonic interview to yahoo-inc for frontend developer. It wasnt Excellent but i answered almost 65-70 answers correctly. And he asked me if i have ne queries. Then no reply from them after that more than 24 hrs gone, i want to know, usually how much time they take to reply, and if they dont pick the candidate, do they inform by mailing like u dont fir the post or nething else??

  • RAHUL

    FREINDS,

    Do you know the fact of yahoo ?

    They take toughest interview in world and still they are in big big loss financially ..
    anytime they can fire software developers , beware of this company.

  • vip

    hello can i know what is responsibilty for a fresher in any IT software company.means what they actually do

  • Pingback: How to Write a Spelling Corrector in Erlang (ESpell) | Abhi's Weblog()

  • Ghanshyam Dobariya

    Thank you very very much..
    Something is added to my knowledge…

  • Neelakshi Naik

    Hello! how long after the interview did you have to wait for the confirmation letter?

  • Android Training in Chennai

    Hi this is Kathiresan i am having 3 years of experience as a dot net developer and i am certified. i have knowledge on OOPS concepts in .NET but dont know indepth. After learning android will be enough to get a good career in IT with good package? and i crossed Android Training in Chennai website where someone please help me to identity the syllabus covers everything or not??

    Thanks,
    kathiresan

  • Android Training in Chennai

    Hi this is Kathiresan i am having 3 years of experience as a dot net developer and i am certified. i have knowledge on OOPS concepts in .NET but dont know indepth. After learning android will be enough to get a good career in IT with good package? and i crossed Android Training in Chennai website where someone please help me to identity the syllabus covers everything or not??

    Thanks,
    kathiresan

  • Great Post please share many more queries …

  • Jenilia Mohan

    thanks for sharing about your personal information sharing with us. its more informative for upcoming students.