PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Chicago

Merge Nested Dictionaries Iteratively

Last updated: Apr 20, 2026

Quick Overview

This question evaluates a candidate's skill in iterative data structure manipulation and handling of nested dictionary merging semantics, including conflict resolution and value overriding.

  • easy
  • Chicago
  • Coding & Algorithms
  • Software Engineer

Merge Nested Dictionaries Iteratively

Company: Chicago

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Take-home Project

Given a list of Python dictionaries, merge them into a single dictionary **without using recursion**. Rules: - Process the dictionaries from left to right. - If a key appears in only one dictionary, keep that key-value pair. - If the same key appears in multiple dictionaries: - when both values are dictionaries, merge those dictionaries using the same rules; - otherwise, the value from the later dictionary overrides the earlier one. - You may assume keys are strings. Example: - Input: - `[{"a": 1, "b": {"x": 2}}, {"b": {"y": 3}, "c": 4}, {"b": {"x": 5}}]` - Output: - `{"a": 1, "b": {"x": 5, "y": 3}, "c": 4}` Implement a function that returns the merged dictionary using an iterative approach.

Quick Answer: This question evaluates a candidate's skill in iterative data structure manipulation and handling of nested dictionary merging semantics, including conflict resolution and value overriding.

Related Interview Questions

  • Determine if tree has path sum - Chicago (easy)
Chicago logo
Chicago
Feb 2, 2026, 12:00 AM
Software Engineer
Take-home Project
Coding & Algorithms
2
0

Given a list of Python dictionaries, merge them into a single dictionary without using recursion.

Rules:

  • Process the dictionaries from left to right.
  • If a key appears in only one dictionary, keep that key-value pair.
  • If the same key appears in multiple dictionaries:
    • when both values are dictionaries, merge those dictionaries using the same rules;
    • otherwise, the value from the later dictionary overrides the earlier one.
  • You may assume keys are strings.

Example:

  • Input:
    • [{"a": 1, "b": {"x": 2}}, {"b": {"y": 3}, "c": 4}, {"b": {"x": 5}}]
  • Output:
    • {"a": 1, "b": {"x": 5, "y": 3}, "c": 4}

Implement a function that returns the merged dictionary using an iterative approach.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Chicago•More Software Engineer•Chicago Software Engineer•Chicago Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.