Swift Interview (Facebook/Meta)
Swift Interview with a Meta engineer
Interview Summary
Problem type
Odd Even Linked List
Interview question
- Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.
The first node is considered odd, and the second node is even, and so on. - Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).
Interview Feedback
Feedback about Serpentine Hawk (the interviewee)
Advance this person to the next round?
Yes
How were their technical skills?
3/4
How was their problem solving ability?
4/4
What about their communication ability?
4/4
Hi Serpentine Hawk, hoping interview was insightful for you. You did well and would definitely get a hire signal if this was a screening interview, and could even get a hire signal for onsite (albeit not with high confidence). You came close to solving two questions. Just that your coding was a little slow, and you completely missed out on doing dry run for your code. That's pretty important. Here's my detailed feedback.
Feedback
- All the β are your strengths. Keep them the same way!
- All π‘ are things you are good at, but an improvement would certainly help you a bit too!
- All β are where I want you to improve from next time onward.
Communication
- Clear in communication β
- Uses comment space efficiently to explain solution β
- Good to mention you're a li'l weak in Linked lists. Will help interviewer probably test you on a different question for 2nd problem. β
- βI think weβre okayβ when interviewer is probing towards optimizing β
- Talks while coding and keeps interviewer engaged β
Technical Knowledge
- Knows about LL β
- Knows about time & space complexity β
- Knows about BFS β
- Couldnβt answer questions on space complexity for q2 β
- Binary tree could be completely skewed to one side, so space complexity would be O(N) then.
- Even when tree is fully balanced, the last level would have O(N/2) elements in queue/array (for BFS), so space complexity would still be O(N).
Problem solving skills
- Found brute force and optimal solution yourself in a few minutes β
- Got optimal solution for second question immediately β
Coding skills
- Code looks clean β
- Thinks about edge cases β
- No dry run for q1 β
- Somewhat slow β
- Couldnβt complete code for q2 but close to it π‘
General Tips:
- Follow this process: Read question β Write/understand test-case if not given β Discuss logic, speak of complexities yourself β Get a nod from interviewer (or re-think optimal solution) β Write code β Do a dry run β Give control back to interviewer
- Aim for first reading each concept, solving about 15-20 problems only related to each concept back to back, and thenONLY start your journey of doing questions randomly from leetcode.
- Buy premium. Only do company tagged problems for companies youβre interviewing for. Try to do 100-150 problems at least, before you have your screening round.
- Prepare a google sheet where you log each problem you do, along with the time it took, and the extent to which you solved it.
- Remember that when you're on this leetcode journey, you gotta solve questions as if you're being interviewed. You will first write down your logic in comments, check with test cases whether it works, if it works you jump to code. You write the code but don't click submit as soon as you feel it's done.
- Make sure to try problems again after a few days for which you failed or struggled (based on the sheet)
- Check optimal solution always for even problems you submitted.
Interview Transcript
Quantum Wolf: Hello
Serpentine Hawk: Hi.
Quantum Wolf: Hi can you hear me?
Serpentine Hawk: Yes, I can hear you well.
Quantum Wolf: All right. How are you?
Serpentine Hawk: I am great. Thank you.
Quantum Wolf: I will try to mimic the exact real interviews that I take at Meta now. The interview structure is like this for coding rounds. It's a 45 minute round in the real interviews, first five minutes again, for introductions, followed by 30 minutes of problem solving, followed by five minutes at the end for you to ask any questions you might have.
Questions:
- Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.
- Given the root of a binary tree, return an array of the largest value in each row of the tree (0-indexed).
Steps of Problem Solving:
- Define edge cases.
- Write pseudocode.
- Ask clarifying questions.
- Discuss logic explanations.
- Code.
- Test with dry run.
Conclusion
Overall performance analysis includes clarity of thought in communication, understanding of technical knowledge, good problem-solving agility, and tackling complexities involved in problem solving.