#include <leetcode.h>
◆ createBinaryTree()
TreeNode * leetcode::create_binary_tree_from_descriptions::Solution::createBinaryTree |
( |
vector< vector< int > > & |
descriptions | ) |
|
|
static |
在文件 leetcode.cpp 第 3965 行定义.
3966 unordered_map<int, TreeNode *> um;
3967 unordered_set<int> nodes;
3968 unordered_set<int> childs;
3969 for(
auto description: descriptions) {
3970 nodes.insert(description[0]);
3971 nodes.insert(description[1]);
3972 childs.insert(description[1]);
3974 for(
auto node: nodes) {
3975 um[node] =
new TreeNode();
3977 for(
auto description: descriptions) {
3978 if(description[2] == 1) {
3980 um[description[0]]->left = um[description[1]];
3983 um[description[0]]->right = um[description[1]];
3986 for(
auto node: nodes) {
3987 if(!childs.contains(node)) {
该类的文档由以下文件生成: