dedupe_preserve_order(items) that removes duplicate values from list items while preserving the order of first appearance. A plain set(items) would remove duplicates but scramble the order — your function must not do that.dedupe_preserve_order([3, 1, 3, 2, 1])
[3, 1, 2]
Each value kept only at its first occurrence, order preserved.
dedupe_preserve_order([])
[]
Empty input stays empty.
Track values you have already seen in a set for O(1) lookup.
Build the result list by appending only unseen values.