Question 1) Write an algorithm to determine whether each distinct number appears at least two times in a list of numbers
3 3 3 5 5 -> True
3 2 5 3 1 -> False
Question 2) Write an algorithm to determine whether a list of numbers can be rearranged into set(s) of five consecutive numbers
1 2 3 4 5 6 7 8 9 10 -> True, (1,2,3,4,5) and (6,7,8,9,10)
1 2 3 4 5 6 7 8 9 -> False
3 6 5 2 5 2 3 4 4 1 -> True (1,2,3,4,5) and (2,3,4,5,6)
Round 2, part 1 -
There is a HTML page like -
HTML: <span><b>This</b> is some <i>example text</i></span>
Convert this into a N-ary tree based on tags and then for each input string find if it exists or not
#"hi" ->yes (inside This)
#"his is some" -> yes (inside This is some)
#"is some example" ->Yes (inside is some example text)
#"is" -> yes
#"balloon" -> no
#"This example text" -> no (because is some comes in between)
Round 2, part 2 -
You are given a music player, which has songs, each song can be considered as a class object, in which members include song name and artist name. Your company has developed an algorithm which shuffles the songs and then shows to the users. Users have complained that although songs are shuffled, many times songs from same artist get grouped together. Create a new algo in which you can address this problem. Create your own classes and objects.
Follow up question - once the new algorithm is developed, you need to write an algorithm which can prove that the new shuffle system is better than the old system
Round 2, part 3 -
There is a list of strings S = ["names","animosity","graph"]
There is a list of characters C = ["n","m","s"]
You need to write a function which will match each character in C with each word in S in the same order and return a list of words which follow that pattern, so here output will be = ["names", "animosity"]
Google focusses a lot on DSA hence there are 4 rounds of DSA. After this if you pass only then there will be 1 round of system design.
Time is a big enemy in google interviews, you need to talk with the interviewer, explain your solution, code it as well as optimize it all within 15-20 mins which is no piece of cake. It means you need to solve medium level leetcode problems within 5-10 mins on your own.
I was rated mid in all 3 rounds hence rejected but I was offered to reappear in 3-4 months instead of cooldown of 1 year.