Linkedin Coachin Interview Experience for Internship 2023
Round 1(Online Test): It was an online 1-hour coding test. The 3 coding questions were easy-medium level questions one was of priority queue ,second of dynamic programming and third of competitive programming .
These were the questions:
Question 1:
Given a set of n tasks, the th (0<i<n) task runs from time start[i] through end[i]. Implement a task scheduler method that finds the minimum number of machines required to complete the tasks. A task can be scheduled on exactly one machine, and one machine can run only one task at a time.
Example:
Suppose n= 5, start = [1, 8, 3, 9, 6], end = [7, 9, 6, 14, 7].
Consider the following task schedule. Times in parentheses are the inclusive start and end times for each job.
Machine 1: [(1, 7). (8, 9)]
Machine 2: [(3, 6). (9. 14)]
Machine 3: [(6, 7)]
Here, the number of machines required is 3.
Question 2:
For a string s which consists only of characters ‘0’ and ‘1’, find the number of subsequences of length 5 which are palindromes.
As the answer can be really big, return the answer mod (1e9+7).
Question 3:
In a park, there are n friends standing in a random order, and they plan to throw a ball around. Each friend has a unique number in the range of 1 to n, inclusive. Theth friend will always throw the ball towards the friend given at receiver[i], and this will happen each second. Friend 1 always starts with the ball, and a player always throws to another player Determine which friend has the ball after k seconds pass.
Note: Friends are numbered starting with 1.
Example:
receiver = [2,4,1.5,3]
seconds = 6
answer=2
Since I solved all 3 questions I got the interview call.
INTERVIEW ROUND:
Round 1 (Technical Interview Round 1): It was a technical round. I was directly asked the language I am comfortable with and I said C++.
Question 1: https://www.w3wiki.net/print-a-given-matrix-in-spiral-form/
Answer: I successfully told the gfg cycle approach. He discussed the time and space complexity and he asked me to optimize it. I was struck for 2-3 minutes so he helped me a bit and I came up with the simulation approach, he seemed satisfied but i faced a bit difficulty in explaining my thought process to him. He said that my approach was good and just discussed the recursion approach where I just nodded and listened to him.
Question 2: https://www.w3wiki.net/the-stock-span-problem/
Answer: I successfully explained my approach and wrote the code
C++
#include <iostream> using namespace std; stack<pair< int , int > > s; int next( int price) { int ans = 1; while (!s.empty() && s.top().first <= price) { ans += s.top().second; s.pop(); } s.push({ price, ans }); return ans; } |
Then i got a call for HR-round where there was general discussion about my projects and the passion that drives me.
Overall, the interview went well , the interviewer was quite friendly and helped me if I was struck somewhere. The questions were similar to those asked in mock-interview rounds of Linkedin-Coachin programme.