Phone Intervew-: Based on previous experience and one question related to database: Design database for querying interest/likes of site users. Assume that number of users is over 6billion.
On-Site Inteview:
Round1: Consider a linkedlist with nodes have next pointer and random pointer. Replicate the list
Round2: Find out if linkedlist is cyclic. If it is cyclic, remove the cycle.
Round3: You are given array of strings, a starting word , an ending word. Design Algorithm and code(any language) to give the shortest path from starting word to ending word, if a path exists. You can move between one word to another by only changing one character in each word. Time: 30 minutes
Example array-{"cat", "bot", "bat", "bog", "mat"}, starting word-cat , ending word-bog
Output: Path exists
Path: cat->bat->bot->bog
I could not solve this problem during the interview. This can be done by constructing a graph and using the shortest path algorithm. Each word would be a node in your graph and it connects to a word which differs only by one character. Ex: cat connects to bat and mat