#include <leetcode.h>
◆ findTarget()
bool leetcode::two_sum_iv_input_is_a_bst::Solution::findTarget |
( |
TreeNode * |
root, |
|
|
int |
k |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 4894 行定义.
4896 unordered_map<int, int> count;
4897 queue<TreeNode *> que;
4899 while(!que.empty()) {
4900 const auto *node = que.front();
4902 s.insert(node->val);
4904 if(node->left !=
nullptr) {
4905 que.push(node->left);
4907 if(node->right !=
nullptr) {
4908 que.push(node->right);
4912 for(
auto it = s.begin(); it != s.end(); ++it) {
4913 int other = k - *it;
4915 if(count[other] > 1) {
4919 }
else if(s.contains(other)) {
引用了 acwing::acwing836_408::root.
该类的文档由以下文件生成: