- 博客(16)
- 收藏
- 关注
原创 【hexo】写博客小tip
官方文档中上传博客需要输入如下指令:$ hexo new "(博客题目)"但是在git bash批量传输博文时,就不是很快捷。笔者发现在_posts文件夹下新建md文档,在开头用源代码形式插入:上传到github: $ hexo clean && hexo g && hexo d...
2021-03-03 11:26:35
146
原创 101. 对称二叉树
(1)代码方法一:递归时间复杂度O(N)空间复杂度O(N)/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public boolean isSymmetric(
2021-03-03 11:22:02
69
原创 104. 二叉树的最大深度
(1)代码①dfs递归/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public int maxDepth(TreeNode root) { r
2021-03-02 10:41:12
96
原创 111. 二叉树的最小深度
(1)代码方法一:bfs通法版/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public int minDepth(TreeNode root) {
2021-03-02 10:38:40
77
原创 102.二叉树层序遍历
①BFS/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public List<List<Integer>> levelOrder(TreeN
2021-03-02 10:36:28
78
原创 145.二叉树后序遍历
(1)递归/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public List<Integer> postorderTraversal(TreeNod
2021-03-02 10:32:03
66
原创 144.二叉树前序遍历
(1)代码①递归/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public List<Integer> preorderTraversal(TreeN
2021-03-02 10:29:29
66
原创 【剑指】67. 把字符串转换成整数
(1)代码class Solution { public int strToInt(String str) { char[] c = str.trim().toCharArray(); if(c.length == 0) return 0; int res = 0, bnday = Integer.MAX_VALUE / 10; int i = 1, sign = 1; if(c[0] == '-') sign =
2021-03-02 10:26:07
86
原创 【剑指】66. 构建乘积数组
(1)代码class Solution { public int[] constructArr(int[] a) { if(a.length == 0) return new int[0]; int[] b = new int[a.length]; b[0] = 1; int temp = 1; for(int i = 1; i < a.length; i++){ b[i] = a[i -
2021-03-02 10:22:32
72
原创 【剑指】68 - II. 二叉树的最近公共祖先
(1)代码老老实实用递归写法就好了,书上写的解法并不是最优解,书上这道题的意思就是还原面试的场景,并不是看题解,书上题解有点费劲。双百解答/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Sol
2021-03-02 10:09:44
88
原创 【剑指】68 - I. 二叉搜索树的最近公共祖先
(1)代码方法一:迭代时间复杂度O(N)空间复杂度O(1)p,q不在同一侧就退出/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { public TreeNode
2021-03-02 10:05:21
85
原创 【剑指】05. 替换空格
(1)代码方法一(书中) 主要将空间复杂度o(n),降到o(1)public class Solution { public String replaceSpace(StringBuffer str) { int len1 = str.length() - 1; for(int i = 0; i <= len1; i++){ if(str.charAt(i) == ' ') str.append(" "); }
2021-03-02 09:53:07
79
原创 【React】网易云要点
通过axios请求数据相关目录 |----services |--request.js #封装的网络请求 |--recommend.js #请求的数据接口 |--config.js #请求地址 |----store |--index.js #引入redux-thunk中间件,导出reducer |--reducer.js #定义数据 |--actio
2021-02-20 14:39:44
120
原创 【Java】仿QQ聊天室
要点整理1、主要界面:登录界面、好友列表界面、聊天界面2、用户登录功能:当用户点击登录后,把qq号码和密码发生给QQServer去验证,如果该用户合法,返回OK,不合法返回err3、在网络间传递对象:对象流4、对message规定一些规则:mesType1->登录成功mesType2->登录失败mesType3->普通消息包mesType4->要求在线好友的包mesType5->返回在线好友的包5、服务器端①服务器端的控制界面,可以启动,关闭服务器,监听用
2021-02-20 14:31:08
375
原创 【React】脚手架踩坑记(2)
上一篇内容写到用$create-react-app my-app搭建脚手架,然后随着node的更新这种方法官方不再支持,出现以下情况笔者的npm版本:因此按照提示操作,进行脚手架的搭建(否则后面还有数不完的坑…这也是为什么会有踩坑记2的由来,当时降低版本搭建结果并不能启动)打开官方文档地址:https://create-react-app.dev/docs/getting-started/...
2020-12-16 16:56:22
133
原创 【React】脚手架踩坑记(1)
项目场景:用npm搭建React脚手架问题描述:npm install -g create-react-app 解决方案:npm config set strict-ssl false
2020-11-15 18:21:40
156
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人