摘要:
在一个数组中找到主要的元素,也就是出现次数大于数组长度一半的元素。容易想到的方式就是计数,出现次数最多的就是majority element,其次就是排序,中间的就是majority element。但是还有两种更有意思的实现方式时间效率O(n),空间效率O(1):1、Moore voting al... 阅读全文
摘要:
写了个抓取appstore的,要抓取大量的app,本来是用httpclient,但是效果不理想,于是直接调用wget下载,但是由于标准输出、错误输出的原因会导致卡住,另外wget也会莫名的卡住。所以我采用:一、独立线程读取输出信息;二、自己实现doWaitFor方法来代替api提供的waitFor(... 阅读全文
摘要:
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["255.2... 阅读全文
摘要:
GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]... 阅读全文
摘要:
PermutationsGiven a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3]... 阅读全文
摘要:
基于bootstrap的选择器http://silviomoreto.github.io/bootstrap-select/ Android: 使用class="selectpicker" 设置选择器。基于bootstrap的分页插件,支持bootstr... 阅读全文
摘要:
SVN项目库错误Unsupported FS format svn: Expected FS format between '1' and '4'; found format '6'从这里找到解决方案 http://stackoverflow.com/a/18382077原因是用 >=1.8版本的S... 阅读全文
摘要:
中文输入使用ibus-pinyin。在ibus-pinyin里使用搜狗词库# wget http://hslinuxextra.googlecode.com/files/sougou-phrases-full.7z# 7za x sougou-phrases-full.7z# cp ibus/and... 阅读全文
摘要:
首先,要检查一下网络适配器的型号。[root@localhost sam]# lspci -nn | grep -i net03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Ex... 阅读全文
摘要:
rpm -e `rpm -qa |grep openoffice` `rpm -qa |grep ooobasis` 这样算是比较彻底的 阅读全文