Use OrderedDict to dedupe stably
Company: Yahoo
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: Medium
Interview Round: Technical Screen
Implement dedupe_preserve_order(seq) that removes duplicates from a list while preserving the order of first appearance, in O(n) time and O(k) space (k = number of unique items). Use collections.OrderedDict (or dict in Python 3.7+) and do not use nested loops or list.index. The function must treat strings case-insensitively for deduplication but return the original casing of the first occurrence. For example, input ['A','b','a','B','c','C','b'] should return ['A','b','c']. Explain the time/space complexity and how your solution behaves if elements are not hashable.
Quick Answer: This question evaluates a candidate's ability to implement stable deduplication using Python's ordered mapping types while handling case-insensitive comparisons that preserve original casing, and to reason about algorithmic complexity such as O(n) time and O(k) space.