Skip to content

Missing Test Case - 1261. Find Elements in a Contaminated Binary Tree #21220

@JMC2002

Description

@JMC2002

LeetCode Username

zi-bu-yu-mf

Problem number, title, and link

  1. Find Elements in a Contaminated Binary Tree https://leetcode.cn/problems/find-elements-in-a-contaminated-binary-tree/

Category of the bug

  • Problem description
  • Solved examples
  • Problem constraints
  • Problem hints
  • Incorrect or missing "Related Topics"
  • Incorrect test Case (Output of test case is incorrect as per the problem statement)
  • Missing test Case (Incorrect/Inefficient Code getting accepted because of missing test cases)
  • Editorial
  • Programming language support

Description of the bug

The target should be larger (up to 1e6)

Language used for code

C++

Code used for Submit/Run operation

bool flg[100003];
class FindElements {
public:
    FindElements(TreeNode* root) {
        memset(flg, 0, sizeof(flg));
        auto dfs = [](auto&& self, TreeNode* node, int val) {
            if (val > 100000)[[unlikely]] return;
            flg[val] = true;
            if (node->left) self(self, node->left, 2 * val + 1);
            if (node->right) self(self, node->right, 2 * val + 2);
        };
        dfs(dfs, root, 0);
    }

    bool find(int target) {
        return flg[target];
    }
};

Expected behavior

The target is up to 1e6, but 1e5 is also passed.

Screenshots

_2@( B )@S(8P$5BCR(K0

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions