LinkedIn Interview Questions from Glassdoor

LinkedIn – Glassdoor 面经
permutations (Scramble an array with an equal chance for every value. Return a list of all permutations of an array.).  

Max subarray problem
Print Tree Level by level

1.      Find the shortest path between two words (like "cat" and "dog), changing only one letter at a time. You need to write code on a laptop and explain the code, run time etc?
2. Design round - In a distributed system cluster set-up, you've exceptions on each and every machine. How would get TOP 10 exceptions in last 24 hr time window.

3. Book Keeping round with Manager - lots of book keeping questions why linkedin etc?

4. One more book keeping round this time with one more guy.
There was no unexpected question as such. One of them involved searching in a matrix sorted row wise. The other one involved finding the exponent of a number in an efficient manner. I figured the exponentiation by squaring method and wrote the pseudo code for that which was correct. All in all, nothing unexpected and the questions can be answered with a little bit of practice. 

 Two sum Problem and check if it is a BST

 Consider an X x Y array of 1's and 0s. The X axis represents "influences" meaning that X influences Y. So, for example, if $array[3,7] is 1 that means that 3 influences 7.

An "influencer" is someone who influences every other person, but is not influenced by any other member.

Given such an array, write a function to determine whether or not an "influencer" exists in the array.
 

At the end of a long day of interviews I was asked about a prior success in my career. I was not told that there was a second more critical part of the interview - another coding exercise at the whiteboard.

Code a non blocking thread safe queue
and
code a text justification routine (Given a line length insert white space so text is uniformly displayed within the given length).

Both are fairly straightforward, but I had spent time on the first portion.
 

How would you design amazon.com?   View Answer
Program an iterator for a Linked List which may include nodes which are nested within other nodes. i.e. (1)->(2)->(3(4))->((5)(6). Iterator returns 1->2->3->4->5->6  

1.      mobile backend system design
2. security system design
3. DP question
4. binary tree question (encode in a line and decode)
  
  1. Implement a shooting algorithm for the game of Battleship.   Answer Question
  2. Implement an algorithm to convert an integer into a roman numeral string and vice versa. 

Implement a hash table

Given a list of numbers L, output a list of numbers where the value at index i is the product of all values in L, excluding the value at index i.

Solve this without using division.

How to write a deep iterator.

 Implement an RPN calculator in Java
One interview was on system design where they asked me to implement my own web crawler system. Again very technical and deep. I didn't know much about search systems so didn't do very well here. Two interviews focused on coding. First was a Dynamic programming question that I had not seen before. Required a bit of help to realize that it was a DP. Was able to write code after I realized the approach. Second coding question was to find the longest arithmetic progression in an array of integers. This was easy.

Implement a function to solve an string given in reverse polish notation. 

 In the first interview: they asked me to implement a pow(base, exp) function. I did a linear solution and they asked me to improve it (time complexity). There's a logN solution for this problem. 

A couple tricky questions. One required writing a modified binary search, the other dealt with data structures and how to efficiently check if a given set of numbers contained two numbers summing to some other number x. 

Implement java's pow function 

None really. Design data structures for different purposes, read a string as a number, write a polish calculator method. 

implement power of POW(double x, int b). Look for special if b<0. write it in O(Log n) time. 

given like +77288.100, a772sb, 2000.00.11.
return if it's a number.
you could either write a regular expression or simply go through the string.
1. it should start with "+/-" or "0-9".
2. there should only have one "." in the string.
3. all other character are "0-9"

 design a key value store 

 Breadth first search  

 implement a concurrent read-write buffer.
Code an RPN calculator with only (+, -, x, /) operations where each operation only takes in two integers as input.  

 Write a function to determine if a string is an integer.
Do you know Design Patterns and can you write a function in java to implement it?  

What is Abstract Class and its use. Gave me a example and asked me to extend and implement its methods   

Write a function to implement BFS.

 The question is how to decide whether the input is a double or not. 
 Traverse a binary there so that the order returned is ordered from smallest to greatest. 
 Find the sqrt of a number

nic interview. 1 coding question and reject.

/**
 * Given two (dictionary) words as Strings, determine if they are isomorphic. Two words are called isomorphic
 * if the letters in one word can be remapped to get the second word. Remapping a letter means replacing all
 * occurrences of it with another letter while the ordering of the letters remains unchanged. No two letters
 * may map to the same letter, but a letter may map to itself.
 *
 * Example:
 * given "foo", "app"; returns true
 * we can map 'f' -> 'a' and 'o' -> 'p'
 *
 * given "bar", "foo"; returns false
 * we can't map both 'a' and 'r' to 'o'
 *
 * given "turtle", "tletur"; returns true
 * we can map 't' -> 't', 'u' -> 'l', 'r' -> 'e', 'l' -> 'u', 'e' ->'r'
 *
 * given "ab", "ca"; returns true
 * we can map 'a' -> 'c', 'b' -> 'a'
 */

Onsite:
1. Find the shortest path between two words (like "cat" and "dog), changing only one letter at a time. You need to write code on a laptop and explain the code, run time etc?
2. Design round - In a distributed system cluster set-up, you've exceptions on each and every machine. How would get TOP 10 exceptions in last 24 hr time window.

3. Book Keeping round with Manager - lots of book keeping questions why linkedin etc?

4. One more book keeping round this time with one more guy.

One of them involved searching in a matrix sorted row wise.

The other one involved finding the exponent of a number in an efficient manner. I figured the exponentiation by squaring method and wrote the pseudo code for that which was correct. 

Consider an X x Y array of 1's and 0s. The X axis represents "influences" meaning that X influences Y. So, for example, if $array[3,7] is 1 that means that 3 influences 7. An "influencer" is someone who influences every other person, but is not influenced by any other member. Given such an array, write a function to determine whether or not an "influencer" exists in the array. 

Code a non blocking thread safe queue
and
code a text justification routine (Given a line length insert white space so text is uniformly displayed within the given length).

·         How would you design amazon.com?   View Answer
·         Program an iterator for a Linked List which may include nodes which are nested within other nodes. i.e. (1)->(2)->(3(4))->((5)(6). Iterator returns 1->2->3->4->5->6  


1. mobile backend system design
2. security system design
3. DP question
4. binary tree question (encode in a line and decode)   Answer Question

 Three of the interviews were similar in format to the phone screen where a shadow interviewer would sit in on the interview. Two of these interviews were coding interviews where I was asked to write code on a white board. The third interview was a design interview where I was asked to design an object oriented web application. The fourth interview was with a hiring manager and seemed more to determine if I would make a good personality fit.

I heard back at the end of the week that I had been extended an offer.

Given a list of numbers L, output a list of numbers where the value at index i is the product of all values in L, excluding the value at index i.

Solve this without using division. 

How to write a deep iterator.
 Implement an RPN calculator in Java

One required writing a modified binary search, the other dealt with data structures and how to efficiently check if a given set of numbers contained two numbers summing to some other number x. 

read a string as a number, write a polish calculator method.

read a string as a number, write a polish calculator method.

 given like +77288.100, a772sb, 2000.00.11.
return if it's a number.
you could either write a regular expression or simply go through the string.
1. it should start with "+/-" or "0-9".
2. there should only have one "." in the string.
3. all other character are "0-9"
that's it.  

** Onsite Interview (6.5 hours)
2x simple coding interviews, 1x design architecture interview, 1x interview with higher up management + lunch, 1x HR.

I would not recommend people to apply or work at this company because management issues can be seen even during the interview process:
1) Each interview you get a senior interviewer and a junior interviewer, during the interview I can see the junior interviewer trying to please the senior interviewer and get attention from the senior interviewer.
2) Higher management guy I met with did not have fond words to say about LinkedIn. When we had lunch, we bumped into a lot of people but no one greeted him. I did not get a feeling that higher management is very liked/approachable by others in the company.

Code an RPN calculator with only (+, -, x, /) operations where each operation only takes in two integers as input. 

 Write a function to determine if a string is an integer.  

·         Do you know Design Patterns and can you write a function in java to implement it?  Answer Question
·         What is Abstract Class and its use. Gave me a example and asked me to extend and implement its methods   Answer Question
·         Write a function to implement BFS. 

Write an iterative version of a recursive function. Yes, it sounds basic, and yes it's easy to do for many problems (tree walking, Fibonacci series, etc). This wasn't one of the straightforward cases.  

double rpn(List<String> ops)' to compute some result using RPN. 

In the final session, the interviewer asked me to pick my favorite project and describe the design in detail. Actually, the paraphrased question was 'you just hired a new developer on this project, how would you get him/her up to speed on developing this new feature'. I described a bit about project and release management logistics, but they were more interested in hearing about and seeing class diagrams, module, component, and network topologies. Finally, the question that threw me off a bit was (since the project I described happened 10 years ago): how would you modernize the project for 2012? What different components or approaches would use and why?

·         How would you design an enhancement to the LinkedIn homepage that displays 24-hour trailing lists (5-minute, 1-hour, 1-day) of the top 5 URLs that users post onto the site?   View Answer
·         Given an interface called IntStream with methods 'bool hasNext()' and 'int next()', implement the function 'IntStream merge(IntStream[] streams)' where each input IntStream produces strictly increasing, possibly infinite number of, integers, and the resultant IntStream also produces strictly increasing integers by merging the input streams. The interviewer also provides a simple test harness that prints the first 5000 integers from that function.   Answer Question
·         Given a single-line text string and a maximum width value, write the function 'string justify(string text, int maxWidth)' that formats the input text using full-justification, i.e., extra spaces on each line are equally distributed between the words; the first word on each line is flushed left and the last word on each line is flushed right. 


Write a routine to find all collinear points in a plane. Constraint: The time complexity cannot be greater than O(n^2). 

 check if a given string is a number

Second one was to write a deep iterator. 
·         Describe your recent project. The reason why you leave the current job.   Answer Question
·         Find maximum successive sum in a array   Answer Question
·         given an article, output in a format that for each line, spaces between words are equal. (If impossible, how to deal with)   Answer Question
·         Reverse words in a sentence  

How u would build a site providing url shortening service.
 How would you improve LinkedIn's personal profile page

This time it was a tough question about writing a program where given a sorted array, repetitions allowed, and given an integer, I had to return the start index and end index of that integer in the array. I chose the Binary Search approach but some modifications had to be made to make it optimistic in run-time.

Find a number in a matrix which is sorted by row and column  

How do you design the monitoring system for linkedin servers?
Some C, C++ questions..also on Data structures...   Answer Question
How do you design the reporting system for linkedin servers

Given a large document and a short pattern consisting of a few words (eg. W1 W2 W3), find the shortest string that has all the words in any order (for eg. W2 foo bar dog W1 cat W3 -- is a valid pattern) 
 Intersection of 2 number arrays.
Design a scalable server for the hangman game


·         Design and implement LRU cache   View Answer
·         Reverse a linked list   View Answer
·         Online system design for monitoring   Answer Question
·         How do you rampup someone fresh from school  

Design and code a system that can accept millions of events in real time and report the number of events for the last 10 minutes (sliding window). The system has to account for performance and concurrency. 
 filteriterator hasnext() and next() function 

 Design a hangman game

·         2 integers that add up to a sum in an array.   Answer Question
·         Top 3 integers in an array   Answer Question
·         Top million word counts in a very large data set like web.   Answer Question
·         Online hangman. About security scaling session stAte etc 

Check if an element is present in a completely sorted 2D array.

Its an easy problem to code, if you can figure out the right approach. 
designing hangman web application

·         Given a unbounded non-block queue, implement a blocking bounded queue   View Answers (2)
·         Give an array that has only the values 1, 2 or 3, sort the array in place. 

·         which project you did before you like most   Answer Question
·         consider a B2C website like Amazon, which will receive thousands requests from buyer per minutes. How will you design the "shop cart " component for it? where should the customs' shop cart data stored? 

·         implement a O(1) min function for Stack   View Answers (6)
·         implement LRU cache 

·         Explain how hashmap is implemented, particularly the put() method.   Answer Question
·         Two cooperative threads, how do you make one thread yield until certain condition is met. 

·         MergeSort   Answer Question
·         Cache design

·         Given a list of numbers, find the contiguous sublist that has the largest sum.   View Answers (5)
·         Given a sorted list of integers, an arbitrary split is made such that the end of the first list is appended to the first, i.e.:

1 2 3 4 5 6 7 8 becomes:

6 7 8 1 2 3 4 5

Find the index of a number N in the array, returning -1 if it does not exist.

determine if a graph is bipartite  
Given an array with duplicate elements give an algorithm to get the count of distinct elements in the array

·         design LRUCache   Answer Question
·         explain about scalability for web applications 

Given a grid of size m by n, write an algorithm that computes all paths from 0,0 to m,n such that you can always step horizontally or vertically but cannot reverse. 
Reverse a single linked list. 


No comments:

Post a Comment