Reported September 2026
Stripetree

Render a Task Tree from CSV Rows

Reported by candidates from Stripe's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Stripe OA. Under 2s to a working solution.
Founder's read

Stripe flagged this one in September 2026, and the whole thing hinges on a plain ordered adjacency map plus a stack (or queue) to walk it in preorder. You get CSV rows, you build a forest, you print it with |- and \- branch markers. It looks like string formatting, but it's really tree construction with a trap in the indentation. If you've got an OA invite and 48 hours, this is the pattern to lock in. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but you should know the shape before you start.

The problem

You are given valid CSV rows describing tasks and nested subtasks. Convert the rows into an ordered forest and return its text rendering.
Each row has one of these two shapes:
A root task: timestamp,task,taskId,taskName.
A subtask: timestamp,subtask,parentId,taskId,taskName.
The timestamp is metadata and does not appear in the result. Task IDs are unique, every parent row appears before its children, and roots and siblings retain their input order.
Render the forest in preorder. A root line is taskId taskName. For every non-root task, indent by two spaces for each ancestor before its parent, then write |- when the task has a later sibling or \- when it is its parent's final child, followed by one space, the task ID, one space, and the task name.
Return one string per rendered line.

Function
renderTaskTree(rows: String[]) → String[]

Examples
Example 1
rows = ["01/01/2025,task,T1,cook dinner","01/01/2025,subtask,T1,T2,buy groceries"]
return = ["T1 cook dinner","\\- T2 buy groceries"]
T1 is a root. Its only child T2 is also its final child, so the second line uses \-.
Example 2
rows = ["01/01/2025,task,T1,plan launch","01/01/2025,subtask,T1,T2,write brief","01/01/2025,subtask,T1,T3,build demo","01/01/2025,subtask,T3,T4,record video","01/01/2025,task,T5,review metrics"]
return = ["T1 plan launch","|- T2 write brief","\\- T3 build demo"," \\- T4 record video","T5 review metrics"]
T2 has a later sibling and uses |-. T3 is the final child of T1, while its child T4 is indented by one two-space ancestor prefix.
Example 3
rows = ["2025-01-01,task,A,alpha","2025-01-01,task,B,beta","2025-01-01,subtask,B,C,gamma","2025-01-01,subtask,B,D,delta","2025-01-01,subtask,D,E,epsilon"]
return = ["A alpha","B beta","|- C gamma","\\- D delta"," \\- E epsilon"]
The two roots preserve input order. Under B, C is nonfinal, D is final, and E is the final child one level deeper.

Constraints
1 <= rows.length <= 200000.
Every row is valid unquoted ASCII CSV in one of the two documented shapes.
Every taskId is unique and every referenced parentId already exists.
The rows describe an acyclic forest with nesting depth at most 200.
Task IDs and names are non-empty and contain no comma.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is two passes. First, parse each row and split on commas. A row with the second field task is a root, and subtask gives you parentId, taskId, name. Store children in a map from parentId to an ordered list, and keep roots in a separate list. Parents always appear before children, so one pass works. Second, traverse in preorder with an explicit stack, since depth is at most 200 but rows go up to 200000. Push children in reverse order. Each stack entry carries its prefix string and whether it's the last child. The pitfall: ancestors don't add a vertical bar, they add plain spaces, two per ancestor before the parent. Check Example 2 and 3 for that. Also remember roots have no marker at all. If you blank on the prefix logic live, StealthCoder is the hedge, but build the prefix as parentPrefix plus two spaces and you're fine.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Render a Task Tree from CSV Rows cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Stripe's OA.

Stripe reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Render a Task Tree from CSV Rows FAQ

What's the trick in the Stripe task tree rendering problem?+

Build an ordered children map keyed by parentId, then do a preorder traversal while carrying an indentation prefix. The only subtle part is picking |- versus \- based on whether the node is the last child of its parent.

How do I get the indentation right?+

Roots print with no prefix and no marker. A child at depth d gets two spaces for each ancestor before its parent, then the marker, a space, the ID, a space, and the name. Pass the prefix down and extend it by two spaces per level. Check against Example 3.

Should I use recursion or an explicit stack?+

Depth is capped at 200, so recursion is probably safe in most languages. With up to 200000 rows, though, an explicit stack is the safer choice. Push children in reverse so they pop in original order. Either way the time is linear.

How hard is this really?+

Easy to medium. There's no clever algorithm, just careful parsing and formatting. Most failures come from sibling order, off-by-one on the last child, or misreading the indentation rule. Run all three examples by hand before submitting.

How do I prepare in 48 hours?+

Write this from scratch twice. Practice splitting rows, building the children map, and a preorder traversal with a prefix. Then try variants, like printing a vertical bar for ancestors, to confirm you understand why this spec uses spaces only.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Stripe.

OA at Stripe?
Invisible during screen share
Get it