3
TreeNode *createBinaryTree(vector<vector<int>> &descriptions) {4
unordered_map<int, TreeNode *> getNode; // to check if node alredy exist5
unordered_map<int, bool> isChild; // to check if node has parent or not6
for (auto &v : descriptions) {7
if (getNode.count(v[0]) == 0) {8
TreeNode *par = new TreeNode(v[0]);11
if (getNode.count(v[1]) == 0) {12
TreeNode *child = new TreeNode(v[1]);13
getNode[v[1]] = child;16
getNode[v[0]]->left = getNode[v[1]]; // left-child18
getNode[v[0]]->right = getNode[v[1]]; // right-child22
for (auto &v : descriptions) {23
if (isChild[v[0]] != true) { // if node has no parent then this is root node