InterviewDB Experience

File Parsing - Parse a Custom Config Format into a Nested Dict

Interview Experience

Problem You are given a string representing a custom config file. The format uses indentation (2 spaces per level) to represent nesting, and key: value pairs. Values may be strings or nested sections. Parse it into a nested Python dict. Example Follow-ups How do you handle tabs vs. spaces, or mixed indentation? What if values can be lists (lines starting with - )? Write a serialize(d: dict) -> str function that is the inverse of parse_config. How would you add line-number error reporting for mal…

Full Details

🔒

Unlock all Affirm questions

Full insider details, leaked discussions, and candidate experiences.

Get full access — $100 a year, unlimited access

About This Question

This is a candidate experience report from a affirm interview during the phone round.

It covers the following topics: Strings, Phone, Sql, Coding, Onsite .