LinkedIn | Phone Screen | Software Engineer | India

Anonymous User
1759
Jan 08, 2025
Jan 09, 2025

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:

  1. Preprocessing with a dictionary: Iterate over known_words, map each word to its phone number, and store the results in a dictionary (phone_to_word). Lookup becomes O(1) for subsequent queries.
  2. Backtracking: Generate all possible strings from the input number and check against known_words. This approach is exponential in time complexity.
    I explained the time complexity for both, and we decided to proceed with Approach 1 due to its efficiency.

Initial Solution:
Here’s my code for Approach 1 (written during the interview):

class Solution:
    def __init__(self, known_words: List[str]):
        self.keywords = {"", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}
        self.known_words = known_words

    def get_phone_no(self, word: str) -> str:
        char_to_no = {}
        for i, letters in enumerate(self.keywords):
            for char in letters:
                char_to_no[char] = i + 1

        phone_no = ""
        for char in word:
            phone_no += str(char_to_no[char])
        return phone_no

    def number_to_list(self, input_number: str) -> List[str]:
        phone_to_word = {}
        for word in self.known_words:
            phone_no = self.get_phone_no(word)
            if phone_no not in phone_to_word:
                phone_to_word[phone_no] = []
            phone_to_word[phone_no].append(word)
        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?

Comments (10)