Your question is Optimizing a Legacy Code Path. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Describe an instance where you optimized a legacy code path for better performance.
For the coding portion, implement the optimized equivalent: given a list of values, return a new list containing each value once, preserving its first-occurrence order. Use def deduplicate(values):; inputs and outputs are lists of integers. For example, [4, 2, 4, 1, 2] returns [4, 2, 1], and [] returns []. The input length is at most 10^4.
def deduplicate(values):