LinkedIn interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

LinkedIn
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 5 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Campus
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Easy
Face to Face
Duration60 minutes
Interview date27 Apr 2015
Coding problem2

In first round they asked me 2 coding questions where he asked me to code as close as possible to the actual one.

1. Ninja and Two Sorted Arrays

Moderate
15m average time
85% success
0/80
Asked in companies
HSBCHikeAmazon

Ninja has been given two sorted integer arrays/lists ‘ARR1’ and ‘ARR2’ of size ‘M’ and ‘N’. Ninja has to merge these sorted arrays/lists into ‘ARR1’ as one sorted array. You may have to assume that ‘ARR1’ has a size equal to ‘M’ + ‘N’ such that ‘ARR1’ has enough space to add all the elements of ‘ARR2’ in ‘ARR1’.

For example:

‘ARR1’ = [3 6 9 0 0]
‘ARR2’ = [4 10]
After merging the ‘ARR1’ and ‘ARR2’ in ‘ARR1’. 
‘ARR1’ = [3 4 6 9 10]
Problem approach

A simple approach would be to create a new arrays with size as sum of the sizes of both the arrays. Copy the elements of both the arrays in the new array and sort the array. 
A space optimized approach also exists. While traversing the two sorted arrays parallelly, if we encounter the jth second array element is smaller than ith first array element, then jth element is to be included and replace some kth element in the first array. 

Algorithm
1) Initialize i,j,k as 0,0,n-1 where n is size of arr1 
2) Iterate through every element of arr1 and arr2 using two pointers i and j respectively
if arr1[i] is less than arr2[j]
increment i
else
swap the arr2[j] and arr1[k]
increment j and decrement k

3) Sort both arr1 and arr2

Try solving now

2. Word Distance

Easy
15m average time
85% success
0/40
Asked in companies
AmazonSalesforceLinkedIn

You are given a document as an Array/List 'ARR' of words of length ‘N’. You have to perform Q queries. In each query, you are given two words. Your task is to find the smallest distance between these two words in a document and return it.

Distance between words is defined as the difference between their indexes.

For example:

ARR=[‘hot’, ‘a’, ‘b’, ‘dog’] and query = (‘hot’, ‘dog’) 

The answer, in this case, is 3 as the minimum distance between ‘hot’ and ‘dog’ in the given document is 3.  

Note:

If any one of the words is not present in the document then your program must return ‘N’ which is the length of the document.
Problem approach

The idea is to traverse over all the elements in the array in two nested loops. Whenever we get occurrence of word1 or word2, take the minimum of answer and the current distance.
Time Complexity : O((N^2)*M), where N is the number of elements in the array and M is the maximum length of a string present in the array. 

The idea is to get all the indices where ‘word1’ and ‘word2’ are present and store the indices in an array. Both the arrays will already be sorted as we found the indices by iterating over the array. Then we will use the two-pointer approach to find the minimum distance between ‘word1’ and ‘word2’.

Algorithm:
• Declare two arrays, that store the indices in which word1 and word2 are present, respectively.
• Declare a variable answer to store the maximum integer value. 
• Iterate over the array ‘arr’:
o If the name of the current element is the same as ‘word1’, push the current index into the first array.
o If the name of the current element is the same as ‘word2’, push the current index into the second array.
• Initialize two pointers, ‘i’ and ‘j’, which point to the beginning of both the arrays, respectively.
• Execute a while loop with the condition i is less than the size of the first array and j is less than the size of the second array : 
o Update ‘answer’ as the minimum of ‘answer’ and an absolute value of (i-j).
o If j > i, increment i by 1.
o Otherwise, increment j by 1.
• When it comes out of the loop, then return ‘answer’ as the final answer.

Try solving now
02
Round
Easy
Face to Face
Duration60 minutes
Interview date27 Apr 2015
Coding problem2

Then in the second round they asked a little about tree and told me to code 2 codes.

1. Level Order Traversal

Easy
15m average time
85% success
0/40
Asked in companies
WalmartFreshworksAdobe

You have been given a Binary Tree of integers. You are supposed to return the level order traversal of the given tree.

For example:
For the given binary tree

Example

The level order traversal will be {1,2,3,4,5,6,7}.
Problem approach

A queue can be used to do level order traversal of the tree. For each node, first visit the node and then push its children nodes in the FIFO queue. 
printLevelorder(tree)
1) Create an empty queue q
2) temp_node = root /*start from root*/
3) Loop while temp_node is not NULL
a) print temp_node->data.
b) Enqueue temp_node’s children 
(first left then right children) to q
c) Dequeue a node from q.

Time Complexity: O(n) where n is the number of nodes in the binary tree 
Space Complexity: O(n) where n is the number of nodes in the binary tree

Try solving now

2. Combination Sum

Easy
15m average time
85% success
0/40
Asked in companies
UberFacebookLinkedIn

You are given an array 'ARR' of 'N' distinct positive integers. You are also given a non-negative integer 'B'.


Your task is to return all unique combinations in the array whose sum equals 'B'. A number can be chosen any number of times from the array 'ARR'.


Elements in each combination must be in non-decreasing order.


For example:
Let the array 'ARR' be [1, 2, 3] and 'B' = 5. Then all possible valid combinations are-

(1, 1, 1, 1, 1)
(1, 1, 1, 2)
(1, 1, 3)
(1, 2, 2)
(2, 3)
Problem approach

Dynamic programming can be used to solve this problem.
Algorithm : 
countWays(arr, m, N)
Declare and initialize count[N + 1] = {0}
count[0] = 1
for i = 1 to N
for j = 0 to m - 1
if i >= arr[j]
count[i] += count[i - arr[j]]
return count[N]

Try solving now
03
Round
Easy
HR Round
Duration30 minutes
Interview date27 Apr 2015
Coding problem1

HR round with typical behavioral problems.

1. Basic HR Questions

Q1. What are your strengths and weaknesses?
Q2.Why LinkedIn ?

Problem approach

Tip 1: Be sure to do your homework on the organization and its culture before the interview.
Tip 2: Employers want to understand how you use your time and energy to stay productive and efficient. Be sure to emphasize that you adhere to deadlines and take them seriously.
Tip 3: Talk about a relevant incident that made you keen on the profession you are pursuing and follow up by discussing your education.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
3 rounds | 9 problems
Interviewed by LinkedIn
1205 views
0 comments
0 upvotes
company logo
SDE - 1
1 rounds | 3 problems
Interviewed by LinkedIn
992 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by LinkedIn
1155 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by LinkedIn
1183 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by BNY Mellon
6261 views
3 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by BNY Mellon
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by CIS - Cyber Infrastructure
2159 views
0 comments
0 upvotes