![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二叉树
Fighter_Sdx
这个作者很懒,什么都没留下…
展开
-
2021-03-17
class Solution { double min; int result; public int closestValue(TreeNode root, double target) { min = Math.abs(root.val-target); inorder(root,target); return result; } public void inorder(TreeNode root,double t.原创 2021-03-17 21:11:10 · 45 阅读 · 0 评论 -
Leetcode173 二叉树遍历 二叉树迭代器
class BSTIterator { List<Integer> list;//申明集合,在外面定义,是全局定义 int progress;//标识遍历进度 public BSTIterator(TreeNode root) { list=new ArrayList<>();//定义list progress=0;//初始化progress inorder(root);//中序遍历 } p...原创 2021-03-17 19:56:21 · 97 阅读 · 0 评论