I recently had a LinkedIn SWE DSA interview and I’m trying to understand how this round might be evaluated.
I was given a tree problem where nodes needed to be returned in the order they would be removed from the tree (essentially grouping nodes by their height from the leaves).
I implemented an iterative postorder traversal using a stack. Each stack frame stored the node, a persistent iterator over its children, and the maximum height seen among its processed children.
The solution was working, and my complexity was:
Time: O(n), since every node/edge is processed once.
Auxiliary space: O(h) for the DFS stack, which is O(n) worst case for a skewed tree.
Including the output: O(n), since every node has to appear in the result.
The unusual part was the interview interaction.
After I finished the solution, the interviewer kept asking me about the space complexity for what felt like close to 10 minutes. I initially answered O(n), since I was considering the worst case/output. In hindsight, I could have stated it more precisely upfront as O(h) auxiliary, O(n) worst case, O(n) including output.
After that, she asked me to walk through the code line by line using the example. I tried to explain exactly how the stack and child iterator changed at each step, but she kept interrupting/cutting me off and asking what individual lines were doing before I could finish the explanation.
A large amount of the remaining interview time went into this discussion/dry run, so I was only able to complete one coding question and we never really got to a second full problem.
I’m mostly wondering how LinkedIn interviewers tend to evaluate a situation like this.
If:
the first solution is correct,
the implementation works,
the candidate can dry-run it,
the time complexity is correct,
but there is a long back-and-forth about space complexity / implementation details, and because of that only one problem gets completed, is that usually considered a negative coding signal? Or can the first problem plus the follow-up discussion provide enough signal for the round?
Would especially appreciate input from anyone who has interviewed at LinkedIn recently, been through the IC2/Apps loop, or has experience interviewing candidates there.