自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(231)
  • 收藏
  • 关注

转载 使用Mosh,本地Mac locale与Remote Debian locale不一致的问题

事实上, 你并不需要安装语言包, 只需安装中文字体并将/etc/locale.gen 中zh_CN.UTF-8 前的注释符号去掉, 执行sudo locale-gen 然后重启即可。转载于:https://www.cnblogs.com/aboutblank/p/10705348.html...

2019-04-14 15:31:00 181

转载 git快捷命令缩写

# Query/use custom command for `git`.zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd: ${_omz_git_git_cmd:=git}## Functions## The name of the current branch# Back-...

2019-03-19 14:30:00 310

转载 如何解决mosh中翻页只能查看一屏的问题

最近用mosh替换了ssh作为连接开发机的工具,发现另外一个问题,ls cat随便什么命令输出结果超过一行的,向上翻页就没有了,找了下官网的FAQ也提到了这个问题,目前解决方案是使用tmux或者screen。。。Q: Why is my terminal's scrollback buffer incomplete?Mosh synchronizes only thevisib...

2019-03-14 14:17:00 622

转载 推荐几个Mac/Linux下比较好用的工具

1、Tmux,连接开发机可以让在任务在开发机一直执行,不用nohup &这种了也相对稳定,还有session可以记录当时的状态。常用命令:tmux new -s name 指定名字开启一个tmux sessiontmux ls 显示sessionstmux a -t name 指定name连接到sessionCtrl + b,D 断开一个se...

2019-03-07 11:39:00 2663

转载 Mac使用GNU版本的sed

今天在mac下用sed试图替换\t ,结果发现不生效,Google之后发现mac作为unix分支的系统上的sed与GNU版本的sed行为不太一致。使用以下命令安装GNU命令套件:brew install coreutils使用以下命令安装gnu-sed:brew install gnu-sed--with-default-names以上命令安装的gnu套...

2018-11-26 22:05:00 373

转载 GOPL第三章练习题3.3 3.4代码

练习3.3是peak展示为红色,valley展示为蓝色。练习3.4是将svg图像打印到浏览器中。// Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.// License: https://creativecommons.org/licenses/by-nc-sa/4.0/// See pa...

2018-10-09 23:00:00 101

转载 剑指offer——27. 二叉搜索树与双向链表(Java版)

题目:剑指offer的题目有挺多都挺典型的,就像这一道。不过书中的代码写的真是ugly,有很多题目LeetCode上都有,可以去LeetCode讨论区看看,经常有一些大神分享,写的代码真是高效、简洁、清晰,剑指offer上的代码不仅变量名定义又长又不知所云,让人看着就很不清晰明了,还有各种没必要的判断让代码看起来非常不直观。思路:书中已经写的挺清楚了,通过中序遍历来做。...

2018-09-16 00:08:00 81

转载 188. Best Time to Buy and Sell Stock IV——LeetCode

Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete at mostktransactions.Note:You may not...

2018-09-14 18:01:00 61

转载 123. Best Time to Buy and Sell Stock III ——LeetCode

Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete at mosttwotransactions.Note:You ...

2018-09-14 16:10:00 85

转载 122. Best Time to Buy and Sell Stock II ——LeetCode

Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., b...

2018-09-14 14:16:00 94

转载 121. Best Time to Buy and Sell Stock——Leetcode

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the st...

2018-09-14 11:13:00 63

转载 Search in Rotated Sorted Array——LeetCode

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,[0,1,2,4,5,6,7]might become[4,5,6,7,0,1,2]).You are given a target value to search. I...

2018-09-13 23:43:00 69

转载 iPad游戏 Calcculator: The Game 程序自动计算求解方法

今天在iPad上下了个小游戏,主要是一个计算器的界面,有开始值,目标值,限定步数,以及一些加减乘除,还有作者脑洞想出来的功能键,主要有左移,直接把一个数加到末尾,将其中的某个数改为另一个数等等。。玩到20几关的时候感觉每道题要想一会儿才能解出来,于是有了下面的程序,写完程序就不想玩了。游戏界面如下,就像一个真的计算器。其中紫色的2、5分别表示在当前数字最后插入2、5,+5和-5就是加...

2018-08-25 01:10:00 147

转载 2018海淀人才集体户新生儿落户流程

很久没有更新。记录一下最近去办理新生儿落户时需要注意的问题,给需要的人参考。双方户口页婚姻状态必须为已婚,如有户口是外地的需要注意先变更婚姻状态,避免跑冤枉路。1、先拿着结婚证、身份证、出生证明去海淀人才,直接取号办理新生儿落户,会让你填写一个申请。然后就可以走了,等人才中心短信通知。工作时间周一至周五,早上9点开始办理,下午5点下班。【2018.08.13】12、已经过了两...

2018-08-13 14:56:00 464

转载 Linux 修改默认文件关联打开程序

从总体上讲/etc/gnome/defaults.list保存了全局的打开方式~/.local/share/applications/mimeapps.list 保存了个人的打开方式当这两个文件不一致时,优先采用局部的个人设置。比如我想把打开各种文本默认的gedit程序修改为Atom,可以先grep全局的应用打开方式文件/etc/gnome/defaults.list#gr...

2016-12-16 11:14:00 413

转载 Linux下Java环境变量设置

我用的是oh my zsh,需要修改.zshrc,记一下免得以后忘记在哪儿改的。如果你用的是自带的terminal那么用文本编辑器打开用户目录下的.bash_profile文件在.bash_profile文件中加入:export JAVA_HOME=/path/to/jdkexport PATH=$JAVA_HOME/bin:$PATH export CLASS...

2016-12-02 14:36:00 61

转载 Off-by-one错误

在迭代循环中,误用> < ≥ ≤符号,有可能导致循环次数多一次或者少一次,就会引发off-by-one错误,混用半开区间和闭区间时,也经常发生此类错误,解决方法是利用最小的输入值去测试代码的执行过程,然后再编写正式的程序代码。转载于:https://www.cnblogs.com/aboutblank/p/6065974.html...

2016-11-15 15:37:00 124

转载 Ubuntu全新系统一些配置

0、安装JDK,http://www.oracle.com/technetwork/java/javase/downloads/index.html1、安装Intellij IDEA,https://www.jetbrains.com/idea/2、bash改为zsh,使用oh my zsh,https://github.com/robbyrussell/oh-my-zsh...

2016-07-13 15:07:00 71

转载 单链表快排

不知道为什么,现在某些公司喜欢考单链表快排,有什么意思呢?没意思。首先理解快排的思想,partition,递归。代码里有注释,挺详细的了,自己验证逻辑应该没什么问题。package leetcode.sort;import java.io.FileInputStream;import java.io.FileNotFoundException;import...

2015-11-04 13:20:00 51

转载 Interleaving String——Leetcode

Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="aadbbbaccc", return fal...

2015-10-19 17:27:00 80

转载 POJ 1611 The Suspects

DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the bes...

2015-10-16 10:53:00 45

转载 加权路径压缩并查集实现

package algs4;import edu.princeton.cs.algs4.StdIn;import edu.princeton.cs.algs4.StdOut;import java.io.FileInputStream;import java.io.InputStream;/** * 并查集 * Created by blank...

2015-10-16 10:13:00 263

转载 红黑树实现

package algs4;/** * Created by blank on 2015-10-15 上午10:08. */public class RedBlackTree { private Node root; public void put(Key key, Value value) { root = put(...

2015-10-15 11:19:00 42

转载 统计一个目录下所有普通文件的总行数

 方案一:find.-typef-name"*.c"-execcat{}\;|grep-v'^$'|wc-l    解释:find . -type f -name "*.c" 查找当前目录下所有以.c结尾的文件,如果不考虑文件类型,可以直接实用find . -type f即可。 -exec cat {} \; 是将找到的文件采用cat命令输出; gr...

2015-10-13 11:28:00 226

转载 快速排序

package leetcode.sort;import java.util.Arrays;/** * QuickSort * Created by blank on 2015-09-22 下午12:06. */public class QuickSort { static int[] arr = new int[20]; pu...

2015-09-22 12:13:00 45

转载 堆排序

package leetcode.sort;import java.util.Arrays;import java.util.Random;/** * HeapSort * Created by blank on 15/8/12. */public class HeapSort { public static void main(Stri...

2015-09-22 12:05:00 69

转载 归并排序

package leetcode.sort;import java.util.Arrays;import java.util.Random;/** * Created by blank on 2015-09-22 上午11:42. */public class MergeSort { public static void main(S...

2015-09-22 12:04:00 78

转载 Distinct Subsequences——Leetcode

Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the original string by deleting some (can be ...

2015-09-22 00:16:00 57

转载 Longest Consecutive Sequence——Leetcode

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is[1, 2, 3,...

2015-09-20 21:29:00 53

转载 Different Ways to Add Parentheses——Leetcode

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are+,-and*.Example 1...

2015-09-20 20:25:00 49

转载 Move Zeroes——Leetcode

Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.For example, givennums = [0, 1, 0, 3, 12], after calling yo...

2015-09-20 17:09:00 58

转载 Perfect Squares——Leetcode

Given a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...) which sum ton.For example, givenn=12, return3because12 = 4 + 4 + 4; givenn=...

2015-09-20 17:03:00 61

转载 House Robber II——Leetcode

After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place arearranged in...

2015-09-20 16:44:00 60

转载 Lowest Common Ancestor of a Binary Tree——Leetcode

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest common ancestor is defined between two nod...

2015-09-20 16:39:00 48

转载 Search in Rotated Sorted Array II——LeetCode

Follow up for "Search in Rotated Sorted Array":What ifduplicatesare allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the ...

2015-09-17 21:09:00 54

转载 N-Queens II——Leetcode

Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.计算N皇后的合法解的数量。解题思路:这次使用了更优化的方式判断棋盘上的冲突,abs(curr.row-row)==abs(curr....

2015-09-16 15:46:00 47

转载 Kth Largest Element in an Array

Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given[3,2,1,5,6,4]and k = 2, return 5....

2015-09-16 15:42:00 61

转载 阿里云ECS试用

公司在推一个大项目,感觉阿里云挺好用的,自己搞了台小机器平时可以跑着玩,而且可以做个跳板机,平时学校里的收费网直接用跳板机就可以访问了,直接写个脚本在自己机器上跑一下:#!/usr/bin/expect -fset timeout -1spawn ssh -qTNf -D 127.0.0.1:12345 [email protected] -exact "...

2015-09-14 16:07:00 55

转载 Merge Intervals——LeetCode

Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].题目大意:给定一个组区间,实现一个函数,合并这些区间。解题思路:首先根据start排序,然后开始...

2015-09-11 18:46:00 63

转载 First Bad Version——LeetCode

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based o...

2015-09-11 16:21:00 52

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除