Applied through refferal to Google Banglore.
TPS
Given a tree of family members and their Date of birth. We have to come up with data structure or fuction which should output the name of member whose birthday is next from given date, the sequence should be circular.
Sol:- Came up with simple sorted array based on birthdays. This problem was open to all modifications and interviewer was only interested in all possible solutions for all modification we can make to the question.
Round 1
Q: Given graph of cities and time taken to travel between them. You have given source city A and list of favourite cities. Output the smallest time taken to reach any of the favourite cities fro, city A.
Sol:- Simple Dijkstra.
Follow Up: Now in the same network of cities, you have given city S and city T and list of favourite cities. We have to give the shortest path from city S to city T which must go through atleast one of the favourite city.
Sol:-
- Using Floyd Warshall (N^3)
- Using Dijkstra's twice , once from city S and once from city T and then loop over favourtite cities for shortest distance.
Round2
Q: You have given movies and movies network ( movies which have same genere) and rating for each of these movies. You have to reture list of K most highly rated movies which are related to movie A.
Sol: Build graph from movie relations. BFS over graph from movie A by maintaining the MIN Heap of size K.
Follow up: Just explain the quick select method for solving this instead of using the heap.
Round3
Q: We have given list of pair of strings. Each pair of string has exatly 1 character mismatch in them. we can assume that the character which are mismatched have parent -> child relation and can from chain of multiple characters.
Eg. ('abc','abe') -> Parent ->child :: c->e
Eg. ('abe','abf') -> Parent ->child :: c->e->f
Form list of these pairs we would get chains of characters. We have to find the lenght of the longest such chain. It is given that the 1 chracter would have only 1 parent and 1 child.
Follow Up: Now from the pairs of strings we can form the Polytree ( tree with multiple child , multiple parents). We have to find length of longest chain.

Sol:- Using the DP for lenght of longest chain for each child.
Round4 Googlyness
Generic behaviourial questions.
Team Matching (Took 2-3 months to get team matching round)
Generic behaviourial questions.


