Need the below given input in the given output format. How can I use a brute force approach and dynamic programming approach for this? I tried but could not get any clue how to proceed.
INPUT
[
"Application/Calendar",
"Application/Chrome",
"Application/Webstrom",
"Application/Photoshop",
"Application/firefox",
"Documents/Material-UI/src/index.js",
"Documents/Material-UI/src/tree-view.js"
]
OUTPUT
[
{
"name": "Application",
"children": [
{
"name": "Calendar",
"children": []
},
{
"name": "Chrome",
"children": []
},
{
"name": "Webstrom",
"children": []
},
{
"name": "Photoshop",
"children": []
},
{
"name": "firefox",
"children": []
}
]
},
{
"name": "Documents",
"children": [
{
"name": "Material-UI",
"children": [
{
"name": "src",
"children": [
{
"name": "index.js",
"children": []
},
{
"name": "tree-view.js",
"children": []
}
]
}
]
}
]
}
]