Meta E5 phone screen experience
Summary
I cleared a Meta phone screen where I solved two data structure and algorithm problems, including implementing a custom data structure and 'Copy List with Random Pointer'.
Full Experience
Hello,
Cleared Meta phone screen. Giving back to the community.
Q1. Implement a class for interface DataStructure<T> with 4 methods -
- contains(T t)
- add(T t)
- remove(T t)
- listItemsInOrderOfInsertion()
All operations should be as efficient as possible.
Suggested the optimal solution would be to use a Map and Doubly linked list (similar to LRU Cache) but thought might take longer to code it so initially wrote normal list based container. Interviewer wanted optimal solution so ended up implementing the doubly linked list solution. Discussed TC and SC and dry ran some test cases.
Q2. OG Copy list with random pointer - https://leetcode.com/problems/copy-list-with-random-pointer. Implemented One pass solution to copy next and random pointer using Map<existingNode, cloneNode>. Dry ran test cases and found small bug missing null check in createCloneNode() method.
Recruiter reached out next day with positive feedback.
Interview Questions (2)
Implement a class for interface DataStructure<T> with 4 methods -
- contains(T t)
- add(T t)
- remove(T t)
- listItemsInOrderOfInsertion()
All operations should be as efficient as possible.