## Linkedin Interview Questions

- 0of 0 votes

AnswersIntelligent Substrings:

- himatNIT February 09, 2020 in United States for Hacker rank test

There are two types of characters in a particular language: special and normal. A character is special if its value is 1 and normal if its value is 0. Given string s, return the longest substring of s that contains at most k normal characters. Whether a character is normal is determined by a 26-digit bit string named charValue. Each digit in charValue corresponds to a lowercase letter in the English alphabet.

Example:

s = 'abcde'

alphabet = abcdefghijklmnopqrstuvwxyz

charValue = 10101111111111111111111111

For clarity, the alphabet is aligned with charValue below:

alphabet = abcdefghijklmnopqrstuvwxyz

charValue = 10101111111111111111111111

The only normal characters in the language (according to charValue) are b and d. The string s contains both of these characters. For k = 2, the longest substring of s that contains at most k = 2 normal characters is 5 characters long, abcde, so the return value is 5. If k = 1 instead, then the possible substrings are ['b', 'd', 'ab', 'bc', 'cd', 'de', 'abc', 'cde']. The longest substrings are 3 characters long, which would mean a return value of 3.| Report Duplicate | Flag | PURGE

Linkedin SDE1 - 0of 0 votes

AnswerYou are given an N-Dimensional list with 2 methods:

- neer.1304 May 27, 2019 in United States

i) getDim -> returns the dimensions .e.g [5,4,3].

ii) getElement([i,j,k]) -> return list[i][j][k] . You have to implement a method to sum all elements in the list.| Report Duplicate | Flag | PURGE

Linkedin Senior Software Development Engineer Algorithm - 0of 0 votes

AnswersRead data from a API call that gives org structure data in JSON format and arrange that data in requested format

- logan July 05, 2018 in United States| Report Duplicate | Flag | PURGE

Linkedin Site Reliability Engineer Python - 0of 0 votes

Answerslog file parsing.

- logan July 05, 2018 in United States| Report Duplicate | Flag | PURGE

Linkedin Site Reliability Engineer Python - 0of 0 votes

Answersprint LinkedIn if a number is divisible by 4 and 6, Linked if it is divisible by 4 and in it is by 6.

- logan July 05, 2018 in United States| Report Duplicate | Flag | PURGE

Linkedin Site Reliability Engineer Python - 0of 0 votes

AnswersFor a given set of non-negative integers get the number of subsets that add up to a target value k.

- vmayer99 April 30, 2018 in United States| Report Duplicate | Flag | PURGE

Linkedin Software Engineer Algorithm - 0of 0 votes

AnswersFor a given array of integers compute the maximum sum of any range in the array. Then modify the function to find maximum product (note the effect of negatives on max product).

- vmayer99 April 30, 2018 in United States| Report Duplicate | Flag | PURGE

Linkedin Software Engineer - 0of 0 votes

AnswersWrite a function to compute n^k. (don't forget negative exponents)

- vmayer99 April 30, 2018 in United States| Report Duplicate | Flag | PURGE

Linkedin Software Engineer Algorithm - 0of 0 votes

AnswerImplement below methods

- kay March 16, 2018 in United States for Tools team

//stores the number in some data structure

void store(n);

//tests whether the given number is present as sum of 2 numbers from the data structure store

boolean test(v);

e.g. store -> 1, 3, 5, 6

tests

4 = true (1 + 3)

5 = false (no sum will result into this)

6 = true (1 + 5)| Report Duplicate | Flag | PURGE

Linkedin Member Technical Staff - 0of 0 votes

Answerswrite a program to list factors of a given number

- kay March 16, 2018 in United States for Tools team

e.g. for input as 12, factors are 1, 2, 3, 4, 6, 12| Report Duplicate | Flag | PURGE

Linkedin Member Technical Staff - 0of 0 votes

AnswersConvert Roman to integer and vice-versa

- maddog January 13, 2018 in United States| Report Duplicate | Flag | PURGE

Linkedin Intern - 1of 1 vote

AnswerPrint a binary tree level by level and zig zag order.

- maddog January 13, 2018 in United States| Report Duplicate | Flag | PURGE

Linkedin Intern - 1of 3 votes

AnswerCongrats to F.L.

- aonecoding November 03, 2017 in United States

Got offers from - Youtube(G), LinkedIn, Airbnb, Square, Wish, Blend and NextDoor!

Thanks for sharing the interview experience with us.

LinkedIn

Phone:

- Questions from LC tagged LinkedIn.

Onsite:

- Get sqrt(x). Output a floored integer if result is not a perfect square. sqrt(18) = 4

- Implement BST, insert, delete, search.

- Design a dashboard for service logs stats (sort and aggregate). Scale from 1 to more machines. Discuss async and realtime as different scenarios.| Report Duplicate | Flag | PURGE

Linkedin Software Engineer Algorithm - 1of 1 vote

AnswerIII. Square root of a number?

- aonecoding August 30, 2017 in United States

IV. Expression operators? Add signs (+, -, *, /) to a string to form target

V. Top trending posts in last 5m, 1H, 1Day?| Report Duplicate | Flag | PURGE

Linkedin Software Engineer Algorithm - 0of 0 votes

AnswersI. Closest K nodes to a target in BST? (Do it in O(n)?)

- aonecoding August 30, 2017 in United States

II. Nested List sum?| Report Duplicate | Flag | PURGE

Linkedin Software Engineer Algorithm - 0of 0 votes

Answers/**

* A tournament tree is a binary tree

* where the parent is the minimum of the two children.

* Given a tournament tree find the second minimum value in the tree.

* A node in the tree will always have 2 or 0 children.

* Also all leaves will have distinct and unique values.

* 2

* / \

* 2 3

* / \ | \

* 4 2 5 3

*

* In this given tree the answer is 3.

*/

- lkpunisher April 05, 2017 in United States`class Node { Integer value; Node left, right; Node(Integer value, Node left, Node right) { this.value = value; this.left = left; this.right = right; } } class Solution { /** * This should return the second minimum * int value in the given tournament tree */ public static Integer secondMin(Node root) { } }`

| Report Duplicate | Flag | PURGE

Linkedin Senior Software Development Engineer Trees and Graphs - 0of 0 votes

AnswersGiven a number n that represents n lockers and n students. All lockers start closed. First student goes and opens all the lockers. Second goes and toggles 2nd, 4th, 6th.. lockers. Third student toggles 3rd, 6th, 9th.. lockers. Print the lockers that remain open after all students pass.

- lkpunisher April 05, 2017 in United States`public void lockers(int n) { // Implementation here }`

| Report Duplicate | Flag | PURGE

Linkedin Senior Software Development Engineer Math & Computation - 0of 2 votes

AnswersHow to randomly select a number in an array?

- aonecoding March 22, 2017 in United States

array: [15, 2, 4, 5, 1, -2, 0]

Follow-up:

Given a second array freq where freq[i] represents the occurrence of the ith number in array, how to randomly select a number in array based on the frequency.

Extra requirement:

Could you complete the selection in a single-pass(go through each array only once)?| Report Duplicate | Flag | PURGE

Linkedin Software Engineer Algorithm - 2of 2 votes

Answers/**

* Given a nested list of integers, returns the sum of all integers in the list weighted by their REVERSED depth.

* For example, given the list {{1,1},2,{1,1}} the deepest level is 2. Thus the function should return 8 (four 1's with weight 1, one 2 with weight 2)

* Given the list {1,{4,{6}}} the function should return 17 (one 1 with weight 3, one 4 with weight 2, and one 6 with weight 1)

- xankar March 03, 2017 in United States`*/ public int reverseDepthSum (List<NestedInteger> input) { // implementation here }`

| Report Duplicate | Flag | PURGE

Linkedin Backend Developer Algorithm - 0of 0 votes

AnswersPrint an NxM matrix with nw-se diagonals starting at bottom left corner. Ex:

`1 2 3 4 5 6 7 8 9 10 11 12`

The output should be:

- dora January 06, 2017 in United States`9 5 10 1 6 11 2 7 12 3 8 4`

| Report Duplicate | Flag | PURGE

Linkedin - 0of 0 votes

AnswersIf you can hop 1, 2, or 3 steps at a time, calculate the total number of possible combinations for `n` steps.

- noitidart December 10, 2016 in United States| Report Duplicate | Flag | PURGE

Linkedin Software Engineer Algorithm - 0of 0 votes

Answerspublic interface FirstCommonAncestor {

/**

* Given two nodes of a tree,

* method should return the deepest common ancestor of those nodes.

*

* A

* / \

* B C

* / \ \

* D E H

* / \

* G F

*

* commonAncestor(D, F) = B

* commonAncestor(C, G) = A

* commonAncestor(E, B) = B

*/

Node commonAncestor(Node one, Node two);

}

- BeingUpfront December 01, 2016 in United States`class Node { final Node parent; final Node left; final Node right; public Node(Node parent, Node left, Node right) { this.parent = parent; this.left = left; this.right = right; } boolean isRoot() { return parent == null; } }`

| Report Duplicate | Flag | PURGE

Linkedin Senior Software Development Engineer Data Structures - 0of 0 votes

AnswersFind unique integers from list of integers

`# Question # Write a function that will return an array of integers that occur exactly once in a given array of integers. # e.g. For a list [1,2,3,5,2,2,3,4], return [1,5,4] since they appear once (order does not matter). def once_integers(integers):`

Follow up:

Optimize the code if input is sorted.

- Saurabh October 03, 2016 in United States for Software Developement - Tools`# What if the input is sorted, such as [1,2,2,2,3,3,4,5], could the algorithm be further optimized # (e.g. space complexity)? def once_integers_sorted(integers):`

| Report Duplicate | Flag | PURGE

Linkedin Software Developer - 0of 0 votes

AnswersString Rotation. Given two string check if String1 is rotating match for String2

- Saurabh October 03, 2016 in United States for Software Developement - Tools`# Given two strings. Write a function that will return true if one string is a rotation of the other string. # e.g. 'bca' and 'cab' are rotations of 'abc' and the function should return true # 'barbazfoo', 'oobarbazf' and 'rbazfooba' are rotations of 'foobarbaz' def is_rotation(string1, string2):`

| Report Duplicate | Flag | PURGE

Linkedin Software Developer Algorithm - 0of 0 votes

AnswersYou are designing the client side of a Survey website. Provide the list of classes and methods you will use to break the problem down. Also, provide the API interaction with server.

- andy.r.nathan September 18, 2016 in United States| Report Duplicate | Flag | PURGE

Linkedin Senior Software Development Engineer Object Oriented Design - 0of 0 votes

AnswersGiven an array of numbers find the duplicates

- andy.r.nathan September 14, 2016 in United States for Mobile| Report Duplicate | Flag | PURGE

Linkedin Software Developer Algorithm - 1of 1 vote

AnswersSuppose you have a list of Dishes, where each dish is associated with a list of ingredients. Group together dishes with common ingredients.

- andy.r.nathan September 14, 2016 in United States for Mobile

E.g:

Input:

"Pasta" -> ["Tomato Sauce", "Onions", "Garlic"]

"Chicken Curry" --> ["Chicken", "Curry Sauce"]

"Fried Rice" --> ["Rice", "Onions", "Nuts"]

"Salad" --> ["Spinach", "Nuts"]

"Sandwich" --> ["Cheese", "Bread"]

"Quesadilla" --> ["Chicken", "Cheese"]

Output: ("Pasta", "Fried Rice") ("Fried Rice, "Salad") , ("Chicken Curry", "Quesadilla") ("Sandwich", "Quesadilla")

Follow up: What is the time and space complexity?| Report Duplicate | Flag | PURGE

Linkedin Software Developer Algorithm - 0of 0 votes

AnswersBasic background questions, describe a situation where you proposed a design and it was opposed. What did you do to convince people that your design was sound. Describe a situation where something you suggested resulted in improved process or caused a big positive impact on the company, etc.

- palak.chokshi July 01, 2016 in United States| Report Duplicate | Flag | PURGE

Linkedin Senior Software Development Engineer Experience - 0of 0 votes

AnswersImplement a TwoSum interface that has 2 methods: Store and Test. Store adds an integer to an internal data store and Test checks if an integer passed to Test is the sum of any two integers in the internal data store. Once you provide an answer interviewer will ask the O complexity of the solution and ask you to optimize it.

I provided 2 solutions, one with O(n-square) and another O(n). However the O(n) solution used 2 internal data stores. I was asked to preserve O(n) but not use the second internal store

- palak.chokshi July 01, 2016 in United States`public interface TwoSum { /* * Stores input in an internal data structure. */ public void Store(int input); /* * Returns true if there is any pair of numbers in the internal data structure which * have sum val, and false otherwise. * For example, if the numbers 1, -2, 3, and 6 had been stored, * the method should return true for 4, -1, and 9, but false for 10, 5, and 0 */ public bool Test(int val); } public class TwoSumImpl : TwoSum { private List<int> _store = new List<int>(); private List<int> _sums = new List<int>(); public void TwoSumImp() { } //-3,-2,3,5,7 //-5,0,1,-2,-3,8, public void Store(int input) { if(!_store.Contains(input)) { _store.Add(input); } } public bool Test(int val) { for(int i=0; i<_store.Count;i++) { if(_store[i] < 0) //store[i] is negative { diff = val + Math.Abs(_store[i]); if(_store.Contains(diff)) { return true; } } else //store[i] is positive { diff = val - _store[i]; if(_store.Contains(diff)) { return true; } return false; } } }`

| Report Duplicate | Flag | PURGE

Linkedin Senior Software Development Engineer Algorithm - 1of 1 vote

AnswersWrite a program that takes an integer and prints out all ways to multiply smaller integers that equal the original number, without repeating sets of factors. In other words, if your output contains 4 * 3, you should not print out 3 * 4 again as that would be a repeating set. Note that this is not asking for prime factorization only. Also, you can assume that the input integers are reasonable in size; correctness is more important than efficiency.

- xankar June 07, 2016 in United States

Eg: PrintFactors(12) 12 * 1 6 * 2 4 * 3 3 * 2 * 2| Report Duplicate | Flag | PURGE

Linkedin Software Developer Algorithm

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window