Find sum at level k

In this question, I am not able to understand how a tree can be build from the given inputs

Here, you are supposed to build a generic tree, where 0 means no child, 1 means left child, and 2 means, 1 left and 1 right child, so u can prepare node class and take the data value, and no of children it represents and then using recursive approach, you can build your tree easily.