Done trees-2#1581
Conversation
Construct Binary Tree from Inorder and Postorder Traversal (problem1.java)Your solution is on the right track, but there are a few issues to address:
To improve, correct the comment and ensure all references to traversal orders are accurate. Also, consider adding more comments to explain why you are building the right subtree first. VERDICT: NEEDS_IMPROVEMENT Root to Leaf Sum (problem2.java)Your solution is excellent and matches the reference solution closely. You have correctly implemented the DFS traversal and the logic for building the number. Your comments are clear and demonstrate a good understanding of the complexities. One small suggestion: In the helper function, after checking for the leaf node, you don't need to return immediately. Instead, you can let the recursion handle the null children. This is because when you call if (root.left == null && root.right == null) {
result += sum;
// return; // This return can be removed
}But this is a minor point and your solution is correct as is. Overall, great job! Your code is efficient and clean. VERDICT: PASS |
No description provided.