InterviewDB
Question
Type Print: Implement a Type-Safe Pretty Printer That Renders Nested Data Structures
phone
Question Details
Problem Implement a pretty printer that takes a nested Python object (dicts, lists, primitives, custom objects) and renders it as formatted, indented text. It must handle: cycles (print <circular ref>), custom repr on objects, and a max-depth cutoff (print ... beyond depth d). Example: Follow-ups How do you detect circular references — using id() and a seen set? What is the time and space complexity of your traversal? How would you add colorized terminal output (keys in blue, strings in green, n…
Full Details
🔒
Unlock all Merge questions
Full insider details, leaked discussions, and candidate experiences.
Get full access — $100 a year, unlimited accessAbout This Question
This is a reported interview question from a merge interview during the phone round.