Addepar 1st Technical Round: SSE Frontend
- Experience
- 5 years
- Posted
- 27 Sept 2026
Summary
I interviewed for a Software Engineer Frontend position at Addepar, where I was asked to transform a flat array of objects into a hierarchical tree.
How it went
YOE: 5+
Core Problem: Flat Object Array to Hierarchical TreeProblem Statement:You are given a flat array of objects. Each object represents an entity with a unique id and a parentId. If an entity has a parentId of null or a specific root value, it is a top-level node. Write an optimal algorithm to convert this flat structure into a deeply nested hierarchical tree.
Input:
[
{"id": 1, "name": "Portfolio A", "parentId": null},
{"id": 2, "name": "Equities US", "parentId": 1},
{"id": 3, "name": "Tech Stocks", "parentId": 2},
{"id": 4, "name": "Fixed Income", "parentId": 1},
{"id": 5, "name": "Global Bonds", "parentId": 4}
]
Output:
[
{
"id": 1, "name": "Portfolio A", "children": [
{
"id": 2, "name": "Equities US", "children": [
{"id": 3, "name": "Tech Stocks", "children": []}
]
},
{
"id": 4, "name": "Fixed Income", "children": [
{"id": 5, "name": "Global Bonds", "children": []}
]
}
]
}
]
Questions asked (1)
- 01
Convert Flat Object Array to Hierarchical Tree
Data Structures & Algorithms
You are given a flat array of objects. Each object has an
id,name, andparentId. An object withparentIdofnull(or a designated root value) is a top‑level node. Build an optimal algorithm to convert this flat structure into a deeply nested hierarchical tree.Input Example:
[ {"id": 1, "name": "Portfolio A", "parentId": null}, {"id": 2, "name": "Equities US", "parentId": 1}, {"id": 3, "name": "Tech Stocks", "parentId": 2}, {"id": 4, "name": "Fixed Income", "parentId": 1}, {"id": 5, "name": "Global Bonds", "parentId": 4} ]Output Example:
[ { "id": 1, "name": "Portfolio A", "children": [ { "id": 2, "name": "Equities US", "children": [ {"id": 3, "name": "Tech Stocks", "children": []} ] }, { "id": 4, "name": "Fixed Income", "children": [ {"id": 5, "name": "Global Bonds", "children": []} ] } ] } ]