← Chicago Trading Company Interview Insights

Chicago Trading Company·Software Engineer·Online Assessment (OA)·Intermediate

Intermediate
Apr 2026

Summary

Short Codility OA for a software engineer role at Chicago Trading, just 20 minutes and one coding task. Nothing too wild but the key collision behavior was the part that actually required some thought.

Questions Asked (1)

Q1

Write a function that merges multiple flat Python dictionaries into one. You decide what happens when two dicts share the same key.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The merging itself is straightforward, a loop or unpacking gets you there fast.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the merge policy for duplicate keys (e.g., last-wins, first-wins, or error) and then implement a clean, efficient solution using dictionary unpacking or a loop. Discuss trade-offs like mutability, performance, and readability, and consider edge cases such as empty input or non-dict arguments.

Pro tip: Mention that in Python 3.5+, you can use dictionary unpacking ({**d1, **d2}) for a concise merge, but be aware that it creates a new dictionary and may not be suitable for very large numbers of dictionaries due to memory overhead. Also, highlight that the choice of duplicate key handling should align with business logic, and in trading systems, deterministic behavior is crucial.

1. Clarify requirements

Ask the interviewer about the expected behavior when keys collide (e.g., last value wins, first value wins, raise error, or combine values). Also confirm input types and whether the function should mutate any input.

2. Choose an approach

Decide between using dictionary unpacking (e.g., {**d1, **d2, ...}), a loop with update(), or a more functional approach like reduce. Consider readability, performance, and Python version compatibility.

3. Implement the function

Write clean code with appropriate variable names and comments. Handle edge cases such as empty input list or non-dictionary elements if necessary.

4. Analyze trade-offs

Discuss time and space complexity: merging n dictionaries with total m keys is O(m) time and O(m) space. Compare approaches: unpacking is concise but creates intermediate tuples; update() mutates; reduce can be less readable.

5. Test and validate

Walk through examples, including duplicate keys, empty dicts, and large inputs. Mention potential pitfalls like shallow copying and key ordering (Python 3.7+ preserves insertion order).

Key Points to Mention

  • Duplicate key handling: last-wins is common, but in trading systems, you might need to detect conflicts or apply a custom merge function.
  • Python version considerations: dictionary unpacking ({**d1, **d2}) works in Python 3.5+, while earlier versions require update() or copy().
  • Performance: using update() in a loop is efficient and avoids creating intermediate dictionaries, but mutates the first dict.
  • Immutability: if the original dictionaries should not be modified, create a new dict and update it.
  • Edge cases: empty input list, non-dict elements, and very large numbers of dictionaries.
  • Readability vs. conciseness: a one-liner with unpacking is elegant but may be less clear for complex merge logic.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.