Java后端
·2025-09-10Day9
我之前没有打卡,但是今天要开始了。
1. 今天刷了三道关于sql的题目,限制在两小时内完成,最好是1.5小时,然后不明白的周六日去弄明白。
2. 关于BFS/**
* 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 int maxDepth(TreeNode root) {
if (root == null) {
return 0;
}
Queue<TreeNode> q = new LinkedList<TreeNode>();
q.offer(root);
int result = 0;
while (!q.isEmpty()) {
int size = q.size(); // 这里获取到的是一层的节点数量
while (size > 0) {
TreeNode node = q.poll(); // 出队列
if (node.left != null) {
q.offer(node.left);
}
if (node.right != null) {
q.offer(node.right);
}
size--; // 去除已经被应用的点
}
result++; // 层数
}
return result;
}
}
3. 今天要开始用户中心的学习,先看一节课
4. 临近秋招,有时总是沉不下心,不过想想有时间就学习呗,为了之后的工作
1
0
分享
操作
评论
问答助学
相关内容
0个评论
全部评论
点击登录,快来和大家讨论吧~
表情
图片
暂无评论
