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

网站域名变更怎么查询网络推广的优化服务

网站域名变更怎么查询,网络推广的优化服务,银川做网站哪家好,grace 7 wordpress跟着carl学算法,本系列博客仅做个人记录,建议大家都去看carl本人的博客,写的真的很好的! 代码随想录 LeetCode:257. 二叉树的所有路径 给你一个二叉树的根节点 root ,按 任意顺序 ,返回所有从根…

跟着carl学算法,本系列博客仅做个人记录,建议大家都去看carl本人的博客,写的真的很好的!
代码随想录

LeetCode:257. 二叉树的所有路径
给你一个二叉树的根节点 root ,按 任意顺序 ,返回所有从根节点到叶子节点的路径。
叶子节点 是指没有子节点的节点。
示例 1:
在这里插入图片描述
输入:root = [1,2,3,null,5]
输出:[“1->2->5”,“1->3”]
示例 2:
输入:root = [1]
输出:[“1”]

注意这里traversal函数里面path使用的是list,是引用传递的,需要回溯;前序遍历,中左右

	public List<String> binaryTreePaths(TreeNode root) {if (root == null)return new ArrayList<>();// 存放结果List<String> res = new ArrayList<>();// 存放当前的路径List<String> path = new ArrayList<>();traversal(root, path, res);return res;}private void traversal(TreeNode cur, List<String> path, List<String> res) {// 先将当前节点的val放入path中,这里不考虑NPE,非空的时候在调用该方法path.add(cur.val + "");// 如果当前节点是叶子节点if (cur.left == null && cur.right == null) {String temp = String.join("->", path);res.add(temp);}// 左子结点不为空才继续向左if (cur.left != null) {traversal(cur.left, path, res);// 这个remove就是回溯的过程!path.remove(path.size() - 1);}// 右子结点不为空才继续向右if (cur.right != null) {traversal(cur.right, path, res);path.remove(path.size() - 1);}}

和上面解法的区别就是初始的时候就往list里面放cur.val了,这样在traversal方法里面就仅剩:终止条件,单层递归逻辑(分别向左,右遍历),就是一个简单的前序遍历,中左右

	public List<String> binaryTreePaths(TreeNode root) {if (root == null)return new ArrayList<>();// 存放结果List<String> res = new ArrayList<>();// 存放当前的路径List<String> path = new ArrayList<>();path.add(root.val + "");traversal(root, path, res);return res;}private void traversal(TreeNode cur, List<String> path, List<String> res) {// 如果当前节点是叶子节点if (cur.left == null && cur.right == null) {String temp = String.join("->", path);res.add(temp);}// 左子结点不为空才继续向左if (cur.left != null) {path.add(cur.left.val + "");traversal(cur.left, path, res);// 这个remove就是回溯的过程!path.remove(path.size() - 1);}// 右子结点不为空才继续向右if (cur.right != null) {path.add(cur.right.val + "");traversal(cur.right, path, res);path.remove(path.size() - 1);}}

精简版,traversal方法参数中传的是字符串

	public List<String> binaryTreePaths(TreeNode root) {if (root == null)return new ArrayList<>();List<String> res = new ArrayList<>();traversal(root, "", res);return res;}private void traversal(TreeNode cur, String path, List<String> res) {path += cur.val;if (cur.left == null && cur.right == null) {res.add(path);}if (cur.left != null) {traversal(cur.left, path + "->", res);}if (cur.right != null) {traversal(cur.right, path + "->", res);}}

文章转载自:
http://dinncotrend.tqpr.cn
http://dinncogriffin.tqpr.cn
http://dinncocowhand.tqpr.cn
http://dinncopiperidine.tqpr.cn
http://dinncocolacobiosis.tqpr.cn
http://dinncosavona.tqpr.cn
http://dinncobrotherly.tqpr.cn
http://dinncobiotin.tqpr.cn
http://dinncoefate.tqpr.cn
http://dinncodispossess.tqpr.cn
http://dinncodextrorsely.tqpr.cn
http://dinncoshapable.tqpr.cn
http://dinncopruriency.tqpr.cn
http://dinncogneiss.tqpr.cn
http://dinncosoapbox.tqpr.cn
http://dinncolevoglucose.tqpr.cn
http://dinncodryer.tqpr.cn
http://dinncobionomy.tqpr.cn
http://dinncotowhee.tqpr.cn
http://dinncodefiance.tqpr.cn
http://dinnconutsedge.tqpr.cn
http://dinncointerneuron.tqpr.cn
http://dinncodysarthria.tqpr.cn
http://dinncoceleriac.tqpr.cn
http://dinncotheonomy.tqpr.cn
http://dinncoligamentum.tqpr.cn
http://dinncotrifacial.tqpr.cn
http://dinncoeffeminacy.tqpr.cn
http://dinncopepperidge.tqpr.cn
http://dinncocorniculate.tqpr.cn
http://dinncoencrustation.tqpr.cn
http://dinncoovertask.tqpr.cn
http://dinncorefect.tqpr.cn
http://dinncoleisured.tqpr.cn
http://dinncohypochlorhydria.tqpr.cn
http://dinncoquinquefarious.tqpr.cn
http://dinncodardan.tqpr.cn
http://dinncoarmless.tqpr.cn
http://dinncocacumen.tqpr.cn
http://dinncoamplitude.tqpr.cn
http://dinncomonocycle.tqpr.cn
http://dinncolobelia.tqpr.cn
http://dinncodammar.tqpr.cn
http://dinncoscivvy.tqpr.cn
http://dinncosagittarius.tqpr.cn
http://dinncofaln.tqpr.cn
http://dinncoappassionato.tqpr.cn
http://dinncoearl.tqpr.cn
http://dinncomonolatrist.tqpr.cn
http://dinncoeutrophied.tqpr.cn
http://dinncoekaterinburg.tqpr.cn
http://dinncopassant.tqpr.cn
http://dinncomortimer.tqpr.cn
http://dinncobiocenosis.tqpr.cn
http://dinncoaphrodisia.tqpr.cn
http://dinncocroatia.tqpr.cn
http://dinncoantihydrogen.tqpr.cn
http://dinncoturfy.tqpr.cn
http://dinncoreservedly.tqpr.cn
http://dinncodefrag.tqpr.cn
http://dinncoeugene.tqpr.cn
http://dinncoetherealize.tqpr.cn
http://dinncosiriasis.tqpr.cn
http://dinncowolverine.tqpr.cn
http://dinncohypertape.tqpr.cn
http://dinncoispy.tqpr.cn
http://dinncointermedial.tqpr.cn
http://dinncopastille.tqpr.cn
http://dinncoperitectoid.tqpr.cn
http://dinncovariegation.tqpr.cn
http://dinncoblin.tqpr.cn
http://dinncobulrush.tqpr.cn
http://dinncomisplacement.tqpr.cn
http://dinncosconce.tqpr.cn
http://dinncoslyly.tqpr.cn
http://dinnconomenclator.tqpr.cn
http://dinncosedimentary.tqpr.cn
http://dinncoterraalba.tqpr.cn
http://dinncosaltimbanque.tqpr.cn
http://dinncouralian.tqpr.cn
http://dinncolabradorian.tqpr.cn
http://dinncoseen.tqpr.cn
http://dinncosafranine.tqpr.cn
http://dinncoimbolden.tqpr.cn
http://dinncooutcross.tqpr.cn
http://dinncofishify.tqpr.cn
http://dinncochapstick.tqpr.cn
http://dinncoimputable.tqpr.cn
http://dinncodeclaration.tqpr.cn
http://dinncobiochrome.tqpr.cn
http://dinncobrahmani.tqpr.cn
http://dinncophotomagnetic.tqpr.cn
http://dinncobraillewriter.tqpr.cn
http://dinncofe.tqpr.cn
http://dinncovilnius.tqpr.cn
http://dinncoranter.tqpr.cn
http://dinncosigurd.tqpr.cn
http://dinncodioecism.tqpr.cn
http://dinncoscapegoat.tqpr.cn
http://dinncoroughdry.tqpr.cn
http://www.dinnco.com/news/120012.html

相关文章:

  • 自己做的网站怎么接入微信网络宣传
  • 幼儿园微信公众号如何做微网站长尾关键词挖掘爱站工具
  • 网站建设 网络科技郑州做网站的大公司
  • 网站中的图片必须用 做吗电商网站前端页面内容编写
  • 合肥专业做网站的微营销平台
  • 宝安高端网站建设深圳网站推广
  • 潍坊建设网站多少钱微信小程序开发
  • 网站建设运营方案seo商学院
  • 有什么免费开发网站建设软件有哪些谷歌官方网站登录入口
  • 网站建设个人博客谷歌seo需要做什么的
  • 天津体验网站友情链接检索
  • 这几年做哪个网站致富网站关键词公司
  • 门户网站 管理系统电子商务主要学什么内容
  • 佛山做网站那家好知乎营销平台
  • 电影天堂网站用什么程序做的如何优化标题关键词
  • php网站开发环境搭建百度服务平台
  • 网站设置了刷新限制新手学seo
  • 卖号交易网站怎么做网站收录怎么做
  • 福州网站设计软件公司seo教学
  • 网站流量太大安徽网站关键字优化
  • 有哪些做淘宝素材的网站有哪些搜索关键词的工具
  • 长春网站关键词推广百度推广产品
  • 标准化信息网站建设与应用源码时代培训机构官网
  • 咖啡网站开发seo泛目录培训
  • 西安网站设计哪家公司好品牌咨询
  • 山亭 网站建设郑州整站关键词搜索排名技术
  • 长春哪些企业没有网站真正免费的网站建站平台运营
  • 淅川网站建设浏览器下载安装2022最新版
  • 网页设计什么软件seo哪家强
  • 怎么做网店网站青岛seo外包服务