Hello,
Cleared Meta phone screen. Giving back to the community.
Q1. Implement a class for interface DataStructure<T> with 4 methods -
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.