来写点什么
moringl / blogs Goto Github PK
View Code? Open in Web Editor NEW自己胡乱写写东西,开心就好 ^_^
自己胡乱写写东西,开心就好 ^_^
public List<Integer> preorderTraversal(TreeNode root) {
List<Integer> ret = new LinkedList<>();
recur(root, ret);
return ret;
}
private void recur(TreeNode node, List<Integer> values) {
if(node == null) return;
values.add(node.val);
recur(node.left, values);
recur(node.right, values);
}
public List<Integer> preorderTraversal(TreeNode root) {
List<Integer> ret = new ArrayList<>();
Stack<TreeNode> stack = new Stack<>();
TreeNode node = root;
while(!stack.empty() || node != null) {
while(node != null) {
ret.add(node.val);
stack.push(node);
node = node.left;
}
node = stack.pop().right;
}
return ret;
}
public List<Integer> inorderTraversal(TreeNode root) {
List<Integer> ret = new LinkedList<>();
recur(root, ret);
return ret;
}
private void recur(TreeNode node, List<Integer> values) {
if(node == null) return;
recur(node.left, values);
values.add(node.val);
recur(node.right, values);
}
public List<Integer> inorderTraversal(TreeNode root) {
List<Integer> ret = new ArrayList<>();
Stack<TreeNode> stack = new Stack<>();
while(!stack.empty() || root != null) {
while(root != null) {
stack.push(root);
root = root.left;
}
root = stack.pop();
ret.add(root.val);
root = root.right;
}
return ret;
}
public List<Integer> postorderTraversal(TreeNode root) {
List<Integer> ret = new LinkedList<>();
recur(root, ret);
return ret;
}
private void recur(TreeNode node, List<Integer> values) {
if(node == null) return;
recur(node.left, values);
recur(node.right, values);
values.add(node.val);
}
public List<Integer> postorderTraversal(TreeNode root) {
List<Integer> res = new ArrayList<>();
Deque<TreeNode> stack = new LinkedList<TreeNode>();
TreeNode prev = null;
while (root != null || !stack.isEmpty()) {
while (root != null) {
stack.push(root);
root = root.left;
}
root = stack.pop();
if (root.right == null || root.right == prev) {
res.add(root.val);
prev = root;
root = null;
} else {
stack.push(root);
root = root.right;
}
}
return res;
}
public List<List<Integer>> levelOrder(TreeNode root) {
if (root == null) {
return new ArrayList<List<Integer>>();
}
List<List<Integer>> res = new ArrayList<List<Integer>>();
dfs(1, root, res);
return res;
}
private void dfs(int index, TreeNode root, List<List<Integer>> res) {
if (res.size() < index) {
res.add(new ArrayList<Integer>());
}
res.get(index - 1).add(root.val);
if (root.left != null) {
dfs(index + 1, root.left, res);
}
if (root.right != null) {
dfs(index + 1, root.right, res);
}
}
public List<List<Integer>> levelOrder(TreeNode root) {
List<List<Integer>> ret = new ArrayList<>();
LinkedList<TreeNode> nodes = new LinkedList<>();
if(root != null) nodes.add(root);
while(!nodes.isEmpty()) {
int size = nodes.size();
List<Integer> sub = new ArrayList<>();
for(int i = 0; i < size; i++) {
TreeNode node = nodes.removeFirst();
sub.add(node.val);
if(node.left != null) nodes.add(node.left);
if(node.right != null) nodes.add(node.right);
}
ret.add(sub);
}
return ret;
}
又开始想搭博客了。不知道写啥,先写着呗
兜兜转转,失去了最初始写博客的本心,最开始想简单记一点东西,后面却花了大量的时间在探索其他方面。
去过CSDN,写过几十篇文章,但是CSDN各种审核和下载积分让人难受,一些文章也莫名的被封,虽然找客服后有解封,但是有点厌烦这种束缚的感觉,后面也逐渐不写了,改成了本地记录。
逐渐弃用CSDN期间,一边在用语雀+插件记录文章素材,用typora+图床写博文,也攒了些文章下来,自己胡乱写写,但也想分享出去。
另一边自己买了服务器和域名,写前端写后端,配置服务器,搭建了自己的博客站点,有点成就感,但属实费劲,不大得劲的后台管理系统,和略丑的前端页面,还有等待续费的服务器,后续也舍弃了这种方式。
本着想分享一些自己写的博文,又萌生出搭建博客的想法。
于是开始整活,用Hexo和github page搭建出来了。写一篇文章到页面,需要利用hexo原生的一系列命令,费劲。有个hexo-admin的插件,安装过,不好用,个人觉着也不好看,遂弃之,放弃了这整套方案。
诚然,最近又想在线上写博客了,方便随时查看检索,也可以分享给志同道合的朋友。也无意间,或是突然开窍,发现issues就是个天然的blog平台,可以使用markdown,还有评论,还可以贴小标签 (●'◡'●)
硬伤的地方,网速有点问题,除此之外,倒也还好。也去了解了一下,也有不少大佬是用issue写博客,哈哈哈,是有点开心的,我不是一个人。
在此开篇,随便写点什么,开心就好 ^_^
cmd窗口执行 chcp
命令可以查看当前编码格式。win上默认是GBK格式,所以执行显示对应的编码936
命令 chcp 56001
可以临时修改当前窗口的编码格式为 utf-8。
一劳永逸的办法,需要修改注册表。Win + R 搜索 regedit
打开注册表编辑器
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
打开文件夹Autorun
chcp 65001 && cls
配置完成,以后打开cmd时就都是utf-8的编码格式
chcp 65001
命令已经足够修改编码了,但是每次打开cmd窗口时会显示chcp
命令,所以再增加了一条&& cls
清屏指令
git config --global core.quotepath false
一套组合拳下来,自身的窗口是解决了乱码问题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.