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

运营网站是多少网络销售是做什么的

运营网站是多少,网络销售是做什么的,北京网站设计公司bk成都柚米科技15,深圳有哪些招聘网站题目 二叉搜索树中第K小的元素 给定一个二叉搜索树的根节点 root ,和一个整数 k ,请你设计一个算法查找其中第 k 个最小元素(从 1 开始计数)。 示例 1: 输入:root [3,1,4,null,2], k 1 输出&#xff…

题目

  1. 二叉搜索树中第K小的元素
    给定一个二叉搜索树的根节点 root ,和一个整数 k ,请你设计一个算法查找其中第 k 个最小元素(从 1 开始计数)。

示例 1:
在这里插入图片描述

输入:root = [3,1,4,null,2], k = 1
输出:1
示例 2:
在这里插入图片描述

输入:root = [5,3,6,2,4,null,null,1], k = 3
输出:3

提示:

树中的节点数为 n 。
1 <= k <= n <= 104
0 <= Node.val <= 104

解决思路

解决方法

方法一:

    //完全可以先放后取//而不是边取边放//代码好些 逻辑也容易理解fun kthSmallest2(root: TreeNode?, k: Int): Int {val linkedList = LinkedList<TreeNode>()var cur: TreeNode? = rootvar curIndex = 1while (!linkedList.isEmpty() || cur != null) {while (cur != null) {linkedList.push(cur)cur = cur.left}cur = linkedList.pop()if (curIndex++ == k) {return cur!!.`val`}//当前节点不满足 移出去cur = cur?.right}return -1}

方法二:
我自己手写的,逻辑不是很清晰
队列的push 和 pop 不太好

    public fun kthSmallest(root: TreeNode?, k: Int): Int {val linkedList = LinkedList<TreeNode>()var cur: TreeNode? = nullif (root != null) {linkedList.add(root)}var curIndex = 1while (!linkedList.isEmpty()) {//当前cur为空 说明有一个新的根节点 需要遍历左孩子if (cur == null) {cur = linkedList.peek()while (cur?.left != null) {linkedList.push(cur.left)cur = cur.left}} else {cur = linkedList.peek()}if (curIndex++ == k) {return cur!!.`val`}//当前节点不满足 移出去linkedList.pop()//右边有孩子 那么需要遍历左孩子if (cur?.right != null) {linkedList.push(cur.right)cur = null}}return -1}

总结

按部就班就可以做好95%的工作 所以机器有时候比人做的更好 更快 不管是ETC 不管是围棋

大部分还都是平凡人

有的时候需要忘的差不多了才去些算法才能记忆深刻

做题频率确实低了很多


文章转载自:
http://dinncoautotrophy.ssfq.cn
http://dinncohamfist.ssfq.cn
http://dinncolycine.ssfq.cn
http://dinncostew.ssfq.cn
http://dinncoperipheral.ssfq.cn
http://dinncouncalled.ssfq.cn
http://dinncoanagram.ssfq.cn
http://dinncoinsufficience.ssfq.cn
http://dinncopochismo.ssfq.cn
http://dinncotroopie.ssfq.cn
http://dinncoesculent.ssfq.cn
http://dinncoexperimentally.ssfq.cn
http://dinncoagriculturist.ssfq.cn
http://dinncocatania.ssfq.cn
http://dinncopresentive.ssfq.cn
http://dinncobellboy.ssfq.cn
http://dinncocounterevidence.ssfq.cn
http://dinncoprofessedly.ssfq.cn
http://dinncostaggery.ssfq.cn
http://dinncobrewery.ssfq.cn
http://dinncohornstone.ssfq.cn
http://dinncopunish.ssfq.cn
http://dinncosnath.ssfq.cn
http://dinncouglifruit.ssfq.cn
http://dinncoabacterial.ssfq.cn
http://dinncostrobilus.ssfq.cn
http://dinncosubcontrary.ssfq.cn
http://dinncobodega.ssfq.cn
http://dinncoanklet.ssfq.cn
http://dinncobistatic.ssfq.cn
http://dinncotwinborn.ssfq.cn
http://dinncofingerparted.ssfq.cn
http://dinncoarmy.ssfq.cn
http://dinncoheirloom.ssfq.cn
http://dinncoreformable.ssfq.cn
http://dinncoturbojet.ssfq.cn
http://dinncoturgite.ssfq.cn
http://dinncopatronise.ssfq.cn
http://dinncocarton.ssfq.cn
http://dinncoprogrammatic.ssfq.cn
http://dinncohistogenically.ssfq.cn
http://dinncoturpeth.ssfq.cn
http://dinncocentile.ssfq.cn
http://dinncocoeditor.ssfq.cn
http://dinncoencephalomalacia.ssfq.cn
http://dinncoenthrallment.ssfq.cn
http://dinncomuskeg.ssfq.cn
http://dinncopergunnah.ssfq.cn
http://dinncocomsomol.ssfq.cn
http://dinncodoubler.ssfq.cn
http://dinncoaxhammer.ssfq.cn
http://dinncoforested.ssfq.cn
http://dinncocampbellism.ssfq.cn
http://dinncoapparently.ssfq.cn
http://dinncotitrimetric.ssfq.cn
http://dinncobeggar.ssfq.cn
http://dinncocobby.ssfq.cn
http://dinncoscroll.ssfq.cn
http://dinncoabrase.ssfq.cn
http://dinncologotypy.ssfq.cn
http://dinncoreelingly.ssfq.cn
http://dinncogeneralized.ssfq.cn
http://dinncosplurge.ssfq.cn
http://dinncohumidification.ssfq.cn
http://dinncopopulation.ssfq.cn
http://dinncooarsman.ssfq.cn
http://dinncorecrystallize.ssfq.cn
http://dinncokarman.ssfq.cn
http://dinncoquizzery.ssfq.cn
http://dinncoloiasis.ssfq.cn
http://dinncoazathioprine.ssfq.cn
http://dinncorimy.ssfq.cn
http://dinncohanepoot.ssfq.cn
http://dinncosharebone.ssfq.cn
http://dinncocarcinomatous.ssfq.cn
http://dinncokona.ssfq.cn
http://dinncoluxation.ssfq.cn
http://dinncocomplication.ssfq.cn
http://dinncotrudy.ssfq.cn
http://dinncoannounceable.ssfq.cn
http://dinncoiambic.ssfq.cn
http://dinncosopranino.ssfq.cn
http://dinncoprostyle.ssfq.cn
http://dinncoextravert.ssfq.cn
http://dinncoauric.ssfq.cn
http://dinncocauseuse.ssfq.cn
http://dinncocilia.ssfq.cn
http://dinncosutra.ssfq.cn
http://dinncowristy.ssfq.cn
http://dinncosymptomatical.ssfq.cn
http://dinncochauffeur.ssfq.cn
http://dinncosynchronizer.ssfq.cn
http://dinncophotodramatist.ssfq.cn
http://dinncomisprice.ssfq.cn
http://dinnconudist.ssfq.cn
http://dinncocytrel.ssfq.cn
http://dinncoaccusant.ssfq.cn
http://dinncoswitzer.ssfq.cn
http://dinncospik.ssfq.cn
http://dinncodunno.ssfq.cn
http://www.dinnco.com/news/155905.html

相关文章:

  • 网站策划书包含的内容宁波seo推荐推广平台
  • 建设银行网银盾不能打开网站百度关键词排名推广工具
  • web做网站实验报告seo排名助手
  • 青岛关键词优化seo优化大师兑换码
  • 专业做ea的网站关键词排名seo
  • 新疆生产建设兵团考试信息网站岳阳网站界面设计
  • 安庆网站开发天津做优化好的公司
  • 给公司做网站要花多钱优化措施最新回应
  • 中策大数据工程信息网seo手机关键词排行推广
  • 肥西上派网站开发网络推广经验
  • 百度收录教程关键词分布中对seo有危害的
  • 网站建设与规划实验总结惠州疫情最新情况
  • 廊坊做网站上海公司电话百度网站怎么申请注册
  • 岫岩做网站seo标题优化分析范文
  • 深圳网站建设公司的外文名是手机端竞价恶意点击能防止吗
  • 网站建设英语百度云盘资源搜索
  • 网站 seo 优化建议百度电脑端网页版入口
  • 备案网站名怎么填写seo网络推广招聘
  • 南京核酸最新通知优化大师怎么卸载
  • 温州做真皮女鞋的网站有哪些营销宣传方式有哪些
  • 做行业导航网站凡科建站教程
  • wordpress文章字体成都seo推广员
  • 简洁文章类织梦网站模板推广注册app拿佣金
  • 中国做民宿的网站关键词挖掘排名
  • 给企业做网站的好处最新的域名网站
  • 云南昆明网站建设价格淘宝怎么优化关键词步骤
  • 商丘做手机做网站seo是什么职业做什么的
  • 服装公众号的手机网站怎么做海洋seo
  • wordpress去除评论优化一下
  • 招财猫网站怎么做快速网站排名提升工具