Skip to content

Adding Trees-2 solutions#1566

Open
subbu4061 wants to merge 1 commit into
super30admin:masterfrom
subbu4061:master
Open

Adding Trees-2 solutions#1566
subbu4061 wants to merge 1 commit into
super30admin:masterfrom
subbu4061:master

Conversation

@subbu4061
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Strengths:

  • The solutions are correct and efficient for both problems.
  • The code is well-organized and readable with meaningful variable names.
  • The student provided explanations for both solutions, showing good communication.

Areas for Improvement:

  • For the tree construction problem, note that the recursion order is important: building the right subtree first because the postorder array is processed from the end (which gives the root, then right, then left). This is correctly implemented, but the student should ensure they understand why.
  • In the second problem (Sum Root to Leaf Numbers), the first solution (without global variable) is generally preferred as it avoids instance variables and is more thread-safe. The second solution with a global variable might be acceptable in a coding interview if explained, but the first is cleaner.
  • The student should be consistent with code formatting (e.g., spacing and indentation). For example, in the tree construction code, there is an extra space in inleft, inright in the helper call. Also, in the second solution for Sum Root to Leaf Numbers, the helper method has inconsistent spacing (e.g., helper (TreeNode root, int curr) has a space before the parenthesis). This is minor but worth noting for clarity.

Overall, the student has done an excellent job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants