4894 {
4895 set<int> s;
4896 unordered_map<int, int> count;
4897 queue<TreeNode *> que;
4898 que.push(root);
4899 while(!que.empty()) {
4900 const auto *node = que.front();
4901 que.pop();
4902 s.insert(node->val);
4903 count[node->val]++;
4904 if(node->left != nullptr) {
4905 que.push(node->left);
4906 }
4907 if(node->right != nullptr) {
4908 que.push(node->right);
4909 }
4910 }
4912 for(auto it = s.begin(); it != s.end(); ++it) {
4913 int other = k - *it;
4914 if(other == *it) {
4915 if(count[other] > 1) {
4917 break;
4918 }
4919 } else if(s.contains(other)) {
4921 break;
4922 }
4923 }
4925 }
vector< vector< int > > ans