Add implementation for leetcode problems 98, 105#1735
Add implementation for leetcode problems 98, 105#1735rishigoswamy wants to merge 1 commit intosuper30admin:masterfrom
Conversation
Validate BST (leetcode_105.py)Strengths:
Areas for Improvement:
VERDICT: NEEDS_IMPROVEMENT Construct Binary Tree from Preorder and Inorder Traversal (leetcode_98.py)It appears that you have submitted a solution for the wrong problem (LeetCode 98) instead of the required problem (LeetCode 105). Please ensure that you are solving the correct problem. For LeetCode 105, you need to construct a binary tree from preorder and inorder traversal arrays. For the correct problem, the key idea is to use the preorder array to determine the root node (the first element), then find the position of that root in the inorder array. This splits the inorder array into left and right subtrees. Recursively build the left subtree from the left part and the right subtree from the right part. You can use a hash map to store the indices of the inorder array for efficient root position lookup. The reference solution provided in C++ can be a good guide. You'll need to adapt it to Python. VERDICT: NEEDS_IMPROVEMENT |
No description provided.