Flatten and rebuild nested Python containers

0
Remix

Given an arbitrarily nested mix of lists, tuples and dicts with integer leaves, produce a flat list of the integers in order. Then, given the original structure and a new flat list, rebuild a structure of the same shape filled with the new values.

xAITechnical phone screenEasyLast asked Feb 2026
No answer yet. Write the first one; the best answer gets endorsed.