0 day streak
Anonymous · shared experience20 Mar 2025 · 11 views

Dream11: Turn a flat CSV of nodes with parent ids into a nested JSON tree

Interview question #Dream11 SDE 2 DSA / coding

Problem. You get a CSV string where each row is a node with an id and a parentId. Turn it into a hierarchical JSON structure. Any node whose parentId is null is a root. Every other node goes, recursively, into a children array under its parent.

Context. This was the second question in a JavaScript/platform round for a React Native SDE-2 role. The first question in the same round was writing rateLimiter(func, limit), a wrapper that lets an API-calling function run at most limit times per minute. On that one the interviewer cared a lot about edge cases, and the candidate needed hints on a few they missed.

What mattered. For the CSV-to-tree task, the interviewer wanted the approach explained clearly before coding and then working code. The post doesn't list constraints or sample data.

0 comments

Comments 0

No comments yet. Ask the author something, or add what happened in your own round.