会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
chenghaixinag
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
···
30
下一页
2022年8月27日
算法总结
摘要: 1.二叉树的右侧视图 给定一个二叉树的 根节点 root,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值。 题解:根之前二叉树解题类似,用广度优先搜索或者深度优先搜索遍历二叉树,这个题就是取每一层的最后一个元素,使用一个队列存储每一层的结点完成对层结点遍历 package
阅读全文
posted @ 2022-08-27 22:25 chenghaixinag
阅读(41)
评论(0)
推荐(0)
2022年8月22日
算法总结
摘要: 1.二叉树每层的最大值 给定一棵二叉树的根节点 root ,请找出该二叉树中每一层的最大值。 题解:看见二叉树的题,遍历用深度优先搜索或者广度优先搜索都是有固定模板的,具体看题意,本题可以用深度优先搜索找每一层的最大值 package com.chenghaixiang.jianzhi2.day15
阅读全文
posted @ 2022-08-22 22:38 chenghaixinag
阅读(14)
评论(0)
推荐(0)
2022年8月20日
算法总结
摘要: 1.最近请求次数 写一个 RecentCounter 类来计算特定时间范围内最近的请求。 请实现 RecentCounter 类: RecentCounter() 初始化计数器,请求数为 0 。 int ping(int t) 在时间 t 添加一个新请求,其中 t 表示以毫秒为单位的某个时间,并返回
阅读全文
posted @ 2022-08-20 22:43 chenghaixinag
阅读(27)
评论(0)
推荐(0)
2022年8月19日
算法总结
摘要: 1.每日温度题(一道关于栈的问题) 请根据每日 气温 列表 temperatures ,重新生成一个列表,要求其对应位置的输出为:要想观测到更高的气温,至少需要等待的天数。如果气温在这之后都不会升高,请在该位置用 0 来代替。 输入: temperatures = [73,74,75,71,69,7
阅读全文
posted @ 2022-08-19 22:59 chenghaixinag
阅读(24)
评论(0)
推荐(0)
2022年8月17日
算法总结
摘要: 继续字符串的算法题: package com.chenghaixiang.jianzhi2.day12; import java.util.Deque; import java.util.LinkedList; /** * @author 程海翔 * @school 石家庄铁道大学 */ publi
阅读全文
posted @ 2022-08-17 23:06 chenghaixinag
阅读(23)
评论(0)
推荐(0)
2022年8月16日
算法总结
摘要: 今天放几个关于字符串的算法题 package com.chenghaixiang.jianzhi2.day11; import java.util.*; /** * @author 程海翔 * @school 石家庄铁道大学 */ public class Office033 { } //给定一个字
阅读全文
posted @ 2022-08-16 22:11 chenghaixinag
阅读(20)
评论(0)
推荐(0)
2022年8月15日
算法总结
摘要: 今天放两道刚刷的关于链表的题 package com.chenghaixiang.jianzhi2.day09; import java.util.ArrayList; import java.util.List; /** * @author 程海翔 * @school 石家庄铁道大学 */ pub
阅读全文
posted @ 2022-08-15 22:46 chenghaixinag
阅读(5)
评论(0)
推荐(0)
2022年8月13日
算法总结
摘要: 今天刷了两道动态规划的题,放一下 public class Office088 { public static void main(String[] args) { int[] a={10,15,20}; Solution solution=new Solution(); solution.minC
阅读全文
posted @ 2022-08-13 22:36 chenghaixinag
阅读(13)
评论(0)
推荐(0)
2022年8月8日
算法总结
摘要: package com.chenghaixiang.jianzhi2.day21; /** * @author 程海翔 * @school 石家庄铁道大学 */ public class Office062 { } //Trie(发音类似 "try")或者说 前缀树 是一种树形数据结构,用于高效地存
阅读全文
posted @ 2022-08-08 22:29 chenghaixinag
阅读(20)
评论(0)
推荐(0)
2022年8月6日
算法总结
摘要: package com.chenghaixiang.jianzhi2.day01; /** * @author 程海翔 * @school 石家庄铁道大学 */ public class Ofiice002 { } //给定两个 01 字符串 a 和 b ,请计算它们的和,并以二进制字符串的形式输出
阅读全文
posted @ 2022-08-06 23:23 chenghaixinag
阅读(16)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
···
30
下一页
公告