Round 1: Coding Sample
In this coding sample, I was given 90 minutes to answer 2 coding questions.
Question 1: Given a string A consisting of n characters and a string B consisting of m characters, write a function that will return the number of times A must be stated such that B is a substring of the repeated A. If B can never be a substring, return -1.
A = ‘abcd’
B = ‘cdabcdab’
The function should return 3 because after stating A 3 times, getting ‘abcdabcdabcd’, B is now a substring of A.
You can assume that n and m are integers in the range [1, 1000].
Question 2: Consider an undirected tree with N nodes, numbered from 1 to N. Each node has a label associated with it, which is an integer value. Different nodes can have the same label. Write a function that, given a zero indexed array A of length N, where A[j] is the label value of the (j + 1)-th node in the tree and a zero-indexed array E of length K = (N – 1) * 2 in which the edges of the tree are described, returns the length of the longest path such that all the nodes on that path have the same label. The length is the number of edges in that path.
A = [1, 1, 1, 2, 2]
E = [1, 2, 1, 3, 2, 4, 2, 5]
This tree is shown below. A node follows the form label, value.
----------1, 1 -----1, 2 1, 3 2, 4 2, 5
The function should return 2, because the longest path is 2->1->3, and there are 2 edges in this path.
Assume that 1 <= N <= 1000 and each element of the array A is an integer in the range [1, 1000000000].
Round 2: Phone Interview
In this phone interview I was given one question.
Question: Write a function that takes a list L and returns a random sublist of size N of that list. Assume that the indexes must be in increasing order. That is, you cannot go backwards.
L = [1, 2, 3, 4, 5]
N = 3
The function should return one of these lists:
[1, 2, 3] [1, 2, 4] [1, 2, 5] [1, 3, 4] [1, 3, 5] [1, 4, 5] [2, 3, 4] [2, 3, 5] [2, 4, 5] [3, 4, 5]
Round 3: Phone Interview
I was again asked only one question.
Question: Given a list L of video names and their watch rates, write a function that will return the videos with the top 10 watch rates. Video names may appear more than once.
L = [(‘abc’, 10), (‘def’, 15), (‘ghi’, 10), (‘abc’, 12), …, (‘xyz’, 100)]
The function should return [‘xyz’, ‘abc’, …, ‘def’, ‘ghi’]
I solved all the questions but, unfortunately, I was not selected. Though I was not selected, I had a very positive experience. My interviewers and recruiters were all pleasant to work with. I will definitely try again next year and hopefully, I will clear it and get selected for a full time job.
Tips for Interview:
Ask questions. The interviewer will purposely give you a vague question in hopes of you asking the necessary questions to clarify it for yourself.
Don’t panic. I know it can be nerve racking to go on an interview, especially if it’s your first. But, nerves are only going to make it worse. Collect yourself, and if you don’t know the answer, it’s okay. Think through it for a few minutes and I’m sure anyone can come up with a solution. These questions are designed for you to be able to solve in the allocated time for an interview.
THINK OUT LOUD! I can’t stress this one enough. You are also being judged on your thought process. If your interviewer doesn’t know what you are thinking, they can’t throw you hints or correct you in any way. And believe me, they want to see you succeed. They are there to help you and guide you through the problem.
Other than that, study, study, study. Do as many algorithmically challenging problems as you can. Cracking the Coding Interview and Geeks for Geeks will be your best friends through the study process. Take advantage of these resources.
- Google Interview Experience for Software Engineering Intern
- Google Software Engineering Intern, Fall 2019 - North America
- Google STEP Intern Interview Experience
- Google's Online Challenge for 2021 Intern (India) Experience
- Interview Experience at Expedia India for the profile of a Software Intern
- Traveloka Interview Experience (software engineer intern + full time)
- JP Morgan Chase and Co. Interview Experience | Software Developer Intern
- Sureify Interview Experience | Software Developer Intern
- Postman Interview Experience for Software Engineer Intern
- Adcuratio Interview experience for Software Engineer Intern
- Amazon interview Experience | Set 132 (For SDE Intern)
- Microsoft Interview Experience | Set 51 (For SDE Intern)
- Microsoft Interview experience | Set 73 (On-Campus for IT SDE Intern)
- Qualcomm Interview Experience | Set 4 (Intern + Full Time Employee)
- Amazon Interview Experience | Set 318 (For SDE Intern)
- MakeMyTrip Interview Experience | Set 15 (For DevOps Intern)
- Mphrx Intern Interview Experience | Set 4 (On-Campus)
- Google Summer Trainee Engineering Program(STEP) Interview Experience
- Samsung Semiconductor Institute of Research (SSIR software) intern/FTE | Set-1
- Samsung Semiconductor Institute of Research(SSIR Software) Intern/FTE | Set-2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.