Skip to content

Conversation

@laughWinter
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings October 26, 2025 15:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a Java implementation for LeetCode problem 669 (Trim a Binary Search Tree). The solution uses an iterative approach to trim nodes that fall outside the specified [low, high] range while maintaining the BST structure.

Key changes:

  • Implements a three-phase iterative algorithm: finding a valid root node, trimming the left subtree, and trimming the right subtree
  • Uses a while-loop based approach rather than recursion

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LetMeFly666 LetMeFly666 self-requested a review October 26, 2025 15:20
@@ -0,0 +1,50 @@
import javax.swing.tree.TreeNode;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实去掉或者注释掉会更好一些呢

class Solution {
public TreeNode trimBST(TreeNode root, int low, int high) {
//寻找新的根节点
while(root!=null && (root.val<low || root.val>high)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果再多一些空格,格式就更好看啦

@LetMeFly666
Copy link
Owner

hi~ 非常感谢大佬提供的0699的Java版本的代码!

不过在review时还是有两个小建议,如果这样的话效果应该会更好一点

@LetMeFly666
Copy link
Owner

hi~ 非常感谢大佬提供的0699的Java版本的代码!

不过在review时还是有两个小建议,如果这样的话效果应该会更好一点

我来处理一下吧

@laughWinter
Copy link
Contributor Author

hi~ 非常感谢大佬提供的0699的Java版本的代码!
不过在review时还是有两个小建议,如果这样的话效果应该会更好一点

我来处理一下吧

哈哈哈好的,我也是BUPT的,这是完成老师的一个实验(尝试提交一个PR)

@LetMeFly666 LetMeFly666 merged commit 7c9b56c into LetMeFly666:master Oct 27, 2025
1 check passed
@LetMeFly666
Copy link
Owner

哈哈哈好的,已经合并了

也欢迎校友的继续参与嗷 [Doge]

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