Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kristijorgji/challenge1

My solution to the problem described in the readme section. An algorithmic problem in which you have to parse nodes and form json string from them.
https://github.com/kristijorgji/challenge1

Last synced: about 1 month ago
JSON representation

My solution to the problem described in the readme section. An algorithmic problem in which you have to parse nodes and form json string from them.

Awesome Lists containing this project

README

        

# Challenge 1

This is my solution in C# for the following challenge problem. You are welcomed to provide your own solutions in this repo. I would love to check them out and find out the most efficent way of solving this problem.

The problem:

You are required to implement an algorithm that recursively builds JSON based on the input.
The input is given in the following form:
//.../
//.../
...
//.../
where m,l,k >= 0

Sample input:


a/b/c1
x/b
a/b/c/d
m

Output:
{
a: {
b: {
c: {
d: ""
},
c1: ""
}
},
x: {
b: ""
},
m: ""
}

*Note that ordering of nodes in the output does not matter
**Also, first you can do preprocessing, then apply the recursive algorithm.