NNotion·DSAEngineerTechnical Phone Screen
Practical: Flatten / Transform a Nested Block Tree
Problem
Notion docs are trees of blocks. Given a nested block structure, flatten it to an ordered list (with depth), or move a block subtree to a new parent preserving order. Practical, not LeetCode-style.
Example
blocks tree -> ordered [(block, depth)]; move(subtree, newParent)
Constraints
- Arbitrary nesting; preserve sibling order
What Notion looks for
Practical coding in JS/TS over a real data model. Handle edge cases (move into own descendant).
added 6 days ago