Question bank › Recursion
Dsa Recursion Medium

Nested Dictionaries Sum

You are given a nested dictionary where some values are integers and others are nested dictionaries. Your task is to write a function that calculates the sum of all the integer values in the nested dictionary. For instance, if the input dictionary is {'a': 1, 'b': {'c': 2, 'd': {'e': 3}}}, the output should be 6 (1 + 2 + 3). Read the JSON dictionary from standard input and output the total sum of all integers. Example Input: {"a": 1, "b": {"c": 2, "d": {"e": 3}}, "f": 4} Example Output: 10

Key concepts

recursiondictionariessumming

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.