LinkedIn | Phone Screen | Software Engineer | India
My Interview Experience
I recently had an interview for LinkedIn with two interviewers: a primary and a shadow interviewer. Here's how it went:
Introduction (10-12 mins)
The session started with introductions and a discussion about my projects. I was asked: "Can you share two major problems you faced in your current project and how you overcame them?" with follow questions related to my answer
DSA Questions
Q1. Valid Parenthesis String
I explained my stack-based approach, dry-ran it, and analyzed its time and space complexity. The interviewer then asked me to optimize the space complexity to O(1).
I suggested a counter-based approach, which he approved. I coded the solution and wrote test cases, though I struggled to come up with new edge cases beyond the provided examples. He seemed fine with this and moved on to the next question.
Q2. A Unique Word-to-Number Mapping Problem
Problem Statement (as I remember):
Given:
known_words = ["linkedin", "jjmldfhm", "leetcode", "morning"]
A mapping of letters to digits like phone keypads: {"abc"->2, "def"->3, ..., "wxyz"->9}
Write a program to return words from known_words that map to a given input number.
Example: Input: "54653346" → Output: ["linkedin", "jjmldfhm"].
My Approaches:
Initial Solution:
Here’s my code for Approach 1 (written during the interview):
1class Solution:
2 def __init__(self, known_words: List[str]):
3 self.keywords = {"", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}
4 self.known_words = known_words
5
6 def get_phone_no(self, word: str) -> str:
7 char_to_no = {}
8 for i, letters in enumerate(self.keywords):
9 for char in letters:
10 char_to_no[char] = i + 1
11
12 phone_no = ""
13 for char in word:
14 phone_no += str(char_to_no[char])
15 return phone_no
16
17 def number_to_list(self, input_number: str) -> List[str]:
18 phone_to_word = {}
19 for word in self.known_words:
20 phone_no = self.get_phone_no(word)
21 if phone_no not in phone_to_word:
22 phone_to_word[phone_no] = []
23 phone_to_word[phone_no].append(word)
24 return phone_to_word.get(input_number, [])Follow-up Optimization:
The interviewer asked how this could be optimized for repeated calls to number_to_list.
I moved char_to_no to the constructor to avoid rebuilding it repeatedly.
I suggested precalculating the phone_to_word dictionary in the constructor for further optimization. The interviewer seemed satisfied and didn’t ask me to code it.
Security Discussion (10 mins)
Q3. How does OAuth work?
I explained the OAuth flow, and he seemed content with my answer.
Q4. Where is the bearer token stored on the client side?
I answered: "Local storage."
Q5. If the bearer token is compromised, can an attacker log in as the user?
I couldn't confidently answer this and admitted I wasn’t sure.
Final Thoughts
The overall experience was good, but I’m not satisfied with my performance on the security-related questions. I plan to improve my knowledge in this area. Meanwhile I got a call from HR about moving to next rounds (2 DS-Algo based and 1 System Design Round), if anyone can help me in sharing some pointers how should I prepare for these rounds?