Implement lazy unique-merge generator for sorted streams
Company: Citadel
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Technical Screen
Quick Answer: This question evaluates knowledge of lazy evaluation, Python generators/iterators, merging nondecreasing streams with duplicate elimination, and considerations of time and space complexity in streaming contexts.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([1,2,2,5], [2,3,5,6])
Expected Output: [1, 2, 3, 5, 6]
Explanation: Merge and remove duplicates.
Input: ([], [1,1,2])
Expected Output: [1, 2]
Explanation: One empty input.
Input: ([1,1,1], [1])
Expected Output: [1]
Explanation: Long equal run.
Hints
- Choose a representation that makes the requested operation direct.
- Handle empty inputs and boundary cases first.