Building Tall Buildings on Flat Ground

# Introduction In this challenge, we will be working on building a utility function that converts flat regional data into a hierarchical tree structure. The flat data represents administrative regions such as provinces, cities, and districts, and the tree structure will make it easier for users to visualise the hierarchical relationships. The function should take in an array of flattened regional information and a root ID parameter, and return the corresponding tree structure. The task should be completed using JavaScript without the use of third-party libraries. Let's get started!

|60 : 00

Click the virtual machine below to start practicing