当前位置: 首页 > news >正文

网站seo优化很好徐州百度网络点赞一个公司网站备案吗

网站seo优化很好徐州百度网络点赞,一个公司网站备案吗,网站公司怎么做推广,响应式网站建设如何提示#xff1a;文章写完后#xff0c;目录可以自动生成#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、力扣865. 具有所有最深节点的最小子树二、力扣1123. 最深叶节点的最近公共祖先三、力扣1026. 节点与其祖先之间的最大差值四、力扣1120. 子树的最大平均值 … 提示文章写完后目录可以自动生成如何生成可参考右边的帮助文档 文章目录 前言一、力扣865. 具有所有最深节点的最小子树二、力扣1123. 最深叶节点的最近公共祖先三、力扣1026. 节点与其祖先之间的最大差值四、力扣1120. 子树的最大平均值 前言 二叉树的递归分为「遍历」和「分解问题」两种思维模式这道题需要用到「分解问题」的思维而且涉及处理子树需要用后序遍历 一、力扣865. 具有所有最深节点的最小子树 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode() {}* TreeNode(int val) { this.val val; }* TreeNode(int val, TreeNode left, TreeNode right) {* this.val val;* this.left left;* this.right right;* }* }*/ class Solution {public TreeNode subtreeWithAllDeepest(TreeNode root) {Result res fun(root);return res.node;}public Result fun(TreeNode root){if(root null){return new Result(null,0);}Result left fun(root.left);Result right fun(root.right);if(left.depth right.depth){return new Result(root,left.depth1);}Result res left.depth right.depth ? left : right;res.depth res.depth 1;return res;} } class Result{public TreeNode node;public int depth;public Result(TreeNode node, int depth){this.node node;this.depth depth;} }二、力扣1123. 最深叶节点的最近公共祖先 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode() {}* TreeNode(int val) { this.val val; }* TreeNode(int val, TreeNode left, TreeNode right) {* this.val val;* this.left left;* this.right right;* }* }*/ class Solution {public TreeNode lcaDeepestLeaves(TreeNode root) {Result res fun(root);return res.node;}public Result fun(TreeNode root){if(root null){return new Result(null,0);}Result left fun(root.left);Result right fun(root.right);if(left.depth right.depth){return new Result(root,left.depth1);}Result res left.depth right.depth ? left : right;res.depth res.depth 1;return res;} } class Result{public TreeNode node;public int depth;public Result(TreeNode node, int depth){this.node node;this.depth depth;} }三、力扣1026. 节点与其祖先之间的最大差值 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode() {}* TreeNode(int val) { this.val val; }* TreeNode(int val, TreeNode left, TreeNode right) {* this.val val;* this.left left;* this.right right;* }* }*/ class Solution {int res 0;public int maxAncestorDiff(TreeNode root) {fun(root);return res;}public int[] fun(TreeNode root){if(root null){return new int[]{Integer.MAX_VALUE,Integer.MIN_VALUE};}int[] leftMinMax fun(root.left);int[] rightMinMax fun(root.right);int curMin Math.min(Math.min(leftMinMax[0],rightMinMax[0]),root.val);int curMax Math.max(Math.max(leftMinMax[1],rightMinMax[1]),root.val);res Math.max(res,Math.max(curMax - root.val, root.val - curMin));return new int[]{curMin,curMax};} }四、力扣1120. 子树的最大平均值 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode() {}* TreeNode(int val) { this.val val; }* TreeNode(int val, TreeNode left, TreeNode right) {* this.val val;* this.left left;* this.right right;* }* }*/ class Solution {double res 0;public double maximumAverageSubtree(TreeNode root) {fun(root);return res;}public double[] fun(TreeNode root){if(root null){return new double[]{0,0};}double[] left fun(root.left);double[] right fun(root.right);double curCount left[0] right[0] 1;double curSum left[1] right[1] root.val;res Math.max(res,curSum/curCount);if(curCount 1){return new double[]{curCount,root.val};}return new double[]{curCount,curSum};} }
http://www.hkea.cn/news/14287400/

相关文章:

  • 可以做物理题的网站网站创建域名
  • 有哪些做文创产品的网站怎样查找自己建设的网站
  • 如何做英文网站网络工程师培训大约多少钱
  • 用tomcat做网站网络推广竞价外包
  • 做暧在线观看网站wordpress 区块链媒体
  • 资金盘网站开发公司哪里好满洲里做网站
  • jsq项目做网站枣庄网站建设多少钱
  • 贵阳做网站公司看优秀摄影做品的网站
  • 网站实现留言功能js 获取 网站路径
  • 企业做网站的云南网站优化建站
  • 如何手机创建网站苏州建设工程协会网站
  • 网站模板文件下载dz论坛可以做商业网站
  • 网站建设 APP滨州网站建设腾度
  • 网站文字广告代码学校网站建设维护投标方案
  • 开发网站如何选需要注意什么宁波网站推广方式
  • 做网站建设工资高吗成都网络推广建站
  • c2c平台网站建设新手做自媒体从哪开始
  • 杭州建设招聘信息网站环保创业项目
  • 晨光科技 网站建设天津和平做网站多少钱
  • 如何做局域网网站装修公司的网站怎么做
  • 整站优化方案国家信用信息公示官网
  • 2345中国最好的网址站能做视频的软件有哪些
  • 网站开发二线城市济南品牌网站制作方案
  • 青岛网站建设方案维护盱眙在仕德伟做网站的有几家
  • 自动seo网站源码大连小程序哪个开发公司好
  • 做网站时版权怎么写苏州网站排名优化报价
  • 大庆市萨尔图区建设局网站公司网站制作应该注意些什么
  • 移动网站建设是什么意思沈阳网站维护公司
  • 有做货 物的网站吗少女たちよ在线观看动漫4
  • 做网站应该用什么配置的电脑企业网站群建设规范