2021年11月23日
摘要: 题目 二叉树zigzag遍历 层次遍历:始终左右 zigzag遍历:每层右左左右交替 Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from 阅读全文
posted @ 2021-11-23 05:34 alau 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 题目 与543相似,543是求最长路径,这是最大权重求和(路径不一定最长) A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge con 阅读全文
posted @ 2021-11-23 04:45 alau 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 题目 二叉树的直径,即是求树中任意俩点间的最大距离(深度) Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the len 阅读全文
posted @ 2021-11-23 04:24 alau 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 题目 删除链表head中倒数第N个元素 Given the head of a linked list, remove the nth node from the end of the list and return its head. Example 1: Input: head = [1,2,3 阅读全文
posted @ 2021-11-23 01:13 alau 阅读(26) 评论(0) 推荐(0) 编辑
摘要: https://www.jianshu.com/p/3cd3f2023ac4 https://www.bilibili.com/video/BV1pr4y1c7B8 与AND & 两个1,即为1 或OR | 只要有一个1,即为1 亦或XOR ^ 相同为0,不同为1(不进位加法,0+0=0,1+0=1 阅读全文
posted @ 2021-11-23 00:49 alau 阅读(22) 评论(0) 推荐(0) 编辑