09 2015 档案

摘要:package leetcode.sort;import java.util.Arrays;/** * QuickSort * Created by blank on 2015-09-22 下午12:06. */public class QuickSort { static int[] arr... 阅读全文
posted @ 2015-09-22 12:13 丶Blank 阅读(189) 评论(0) 推荐(0)
摘要:package leetcode.sort;import java.util.Arrays;import java.util.Random;/** * HeapSort * Created by blank on 15/8/12. */public class HeapSort { publi... 阅读全文
posted @ 2015-09-22 12:05 丶Blank 阅读(147) 评论(0) 推荐(0)
摘要:package leetcode.sort;import java.util.Arrays;import java.util.Random;/** * Created by blank on 2015-09-22 上午11:42. */public class MergeSort { publ... 阅读全文
posted @ 2015-09-22 12:04 丶Blank 阅读(194) 评论(0) 推荐(0)
摘要: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 orig... 阅读全文
posted @ 2015-09-22 00:16 丶Blank 阅读(170) 评论(0) 推荐(0)
摘要: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 ... 阅读全文
posted @ 2015-09-20 21:29 丶Blank 阅读(122) 评论(0) 推荐(0)
摘要:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th... 阅读全文
posted @ 2015-09-20 20:25 丶Blank 阅读(166) 评论(0) 推荐(0)
摘要: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, givenn... 阅读全文
posted @ 2015-09-20 17:09 丶Blank 阅读(182) 评论(0) 推荐(0)
摘要: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, return... 阅读全文
posted @ 2015-09-20 17:03 丶Blank 阅读(154) 评论(0) 推荐(0)
摘要: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 t... 阅读全文
posted @ 2015-09-20 16:44 丶Blank 阅读(168) 评论(0) 推荐(0)
摘要: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 ... 阅读全文
posted @ 2015-09-20 16:39 丶Blank 阅读(217) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2015-09-17 21:09 丶Blank 阅读(176) 评论(0) 推荐(0)
摘要:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.计算N皇后的合法解的数量。解题思路:这次使用了更优化的... 阅读全文
posted @ 2015-09-16 15:46 丶Blank 阅读(168) 评论(0) 推荐(0)
摘要: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 exampl... 阅读全文
posted @ 2015-09-16 15:42 丶Blank 阅读(191) 评论(0) 推荐(0)
摘要:公司在推一个大项目,感觉阿里云挺好用的,自己搞了台小机器平时可以跑着玩,而且可以做个跳板机,平时学校里的收费网直接用跳板机就可以访问了,直接写个脚本在自己机器上跑一下:#!/usr/bin/expect -fset timeout -1spawn ssh -qTNf -D 127.0.0.1:123... 阅读全文
posted @ 2015-09-14 16:07 丶Blank 阅读(301) 评论(0) 推荐(0)
摘要: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].题目大意:给定一个组区间,实... 阅读全文
posted @ 2015-09-11 18:46 丶Blank 阅读(165) 评论(0) 推荐(0)
摘要: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 c... 阅读全文
posted @ 2015-09-11 16:21 丶Blank 阅读(174) 评论(0) 推荐(0)
摘要:Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According ... 阅读全文
posted @ 2015-09-11 16:15 丶Blank 阅读(214) 评论(0) 推荐(0)
摘要:Given an array containingndistinct numbers taken from0, 1, 2, ..., n, find the one that is missing from the array.For example,Givennums=[0, 1, 3]retur... 阅读全文
posted @ 2015-09-11 16:09 丶Blank 阅读(170) 评论(0) 推荐(0)
摘要:蓄水池算法要解决的问题就是在不知道流入数据量多少的情况下,依旧可以随机从这些数中选取K个,乍一听好神奇,其实分析一下背后的概率知识,思想还是很简单的,相信看完我的介绍和证明,你也会觉得很简单。假设要求随机选择K个元素,假设一共流入的元素有n个。 首先数组a[0...k-1]表示最后返回的结果,最开... 阅读全文
posted @ 2015-09-11 14:37 丶Blank 阅读(1243) 评论(0) 推荐(0)
摘要:首先是一部分概念和示例,这部分转自:http://coolshell.cn/articles/9104.htmlPattern Space第零个是关于-n参数的,大家也许没看懂,没关系,我们来看一下sed处理文本的伪代码,并了解一下Pattern Space的概念:foreach line in f... 阅读全文
posted @ 2015-09-09 00:22 丶Blank 阅读(851) 评论(0) 推荐(0)
摘要:ctrl+a //移到行首ctrl+e //移到行尾ctrl+y // 插入最近删除的单词或语句ctrl+k //删除光标处到行尾部分ctrl+u //删除光标处到行首部分ctrl+w //删除光标处到当前单词开头部分或语句ctrl+r //搜索命令历史纪录h 左,或 Backspace 或方向键j... 阅读全文
posted @ 2015-09-04 19:12 丶Blank 阅读(1713) 评论(0) 推荐(0)
摘要:使用Solarized dark配色方案需要字体menlo for powerlineoh-my-zsh主题使用agnoster,这个主题默认的路径是全路径,当路径很长的时候,就会占很长的空间,可以修改agnoster.zsh-theme中的方法prompt_dir()prompt_dir() { ... 阅读全文
posted @ 2015-09-04 14:16 丶Blank 阅读(453) 评论(0) 推荐(0)