Pregunta de entrevista de Enosis Solutions (Bangladesh)

Problem Statement:You are given an array of objects where each object represents a node. Each node has an id, a name, and a parentId. If the parentId is null, it means the node is the root. Write a function to transform this flat array into a deeply nested tree structure.