Calculate folder size using recursion.
Asked in the Phone Screen stage. Recursion folder size calculation problem asked during the screening round.
Represent a folder as a dictionary. Each value is either an integer file size in bytes or another dictionary representing a nested folder. Implement calculate_folder_size(folder) to return the total size of every file in the folder and all descendants.
folder, a nested dictionary with non-negative integer file sizes or child-folder dictionaries.def calculate_folder_size(folder):