Meta Interview Question

2 medium LeetCode style questions. One of them was from LeetCode tagged.