Flatten object & Promise.all
Company: TikTok
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Overview: This question evaluates proficiency in JavaScript data manipulation and asynchronous programming, testing competencies in transforming nested objects into single-level key paths and reproducing Promise.all semantics.
Constraints
- 1 <= total number of dictionary entries + list items <= 100000
- Maximum nesting depth <= 500
- All dictionary keys are strings without '.'
- Leaf values can be int, float, str, bool, or None
- Input must not be mutated
Hints
- Use DFS to traverse the structure and build the path as you go.
- Maintain a list of path segments and join with '.' when you reach a leaf.
- Treat dictionaries and lists separately; skip empty ones.