Databricks·Software Engineer·Technical Phone Screen
- Design and implement a set data structure that supports creating snapshot iterators. The set should support add, remove, and contains operations, and an iterator() method that returns an iterator over the state of the set at the moment it was called. Subsequent mutations to the set must not affect already-created iterators.
“My first instinct was just to copy the underlying set into a list when iterator() is called, which is correct but I second-guessed myself for a solid two minutes thinking there was some clever persistent data structure angle they wanted.”