摘要:
echo -e "\033[33;31m Color Text" - red echo -e "\033[33;32m Color Text" - green echo -e "\033[33;33m Color Text" - yellow echo -e "\033[33;34m Color T
阅读全文
posted @ 2016-02-29 11:06
OpenSoucre
阅读(618)
推荐(0)
摘要:
具体可以参考https://github.com/Homebrew/homebrew/issues/21002cd /usr/localgit statusgit reset --hard origin/mastergit clean -d
阅读全文
posted @ 2016-01-12 00:11
OpenSoucre
阅读(2745)
推荐(0)
摘要:
Exception:Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main st...
阅读全文
posted @ 2015-10-27 14:08
OpenSoucre
阅读(18428)
推荐(3)
摘要:
Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?题目意思: 给定一个单链表,判断它是不是回文串 进一步思考: ...
阅读全文
posted @ 2015-08-02 17:12
OpenSoucre
阅读(305)
推荐(0)
摘要:
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is1 -> 2 -> 3 -> ...
阅读全文
posted @ 2015-08-02 15:50
OpenSoucre
阅读(269)
推荐(0)
摘要:
Given two stringssandt, write a function to determine iftis an anagram ofs.For example,s= "anagram",t= "nagaram", return true.s= "rat",t= "car", retur...
阅读全文
posted @ 2015-08-02 15:44
OpenSoucre
阅读(293)
推荐(0)
摘要:
Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota...
阅读全文
posted @ 2015-07-07 19:43
OpenSoucre
阅读(1005)
推荐(0)
摘要:
Given an integer, write a function to determine if it is a power of two.题目意思: 给定一个整数,判断是否是2的幂解题思路: 如果一个整数是2的幂,则二进制最高位为1,减去1后则最高位变为0,后面全部是1,相与判读是否为零,...
阅读全文
posted @ 2015-07-07 16:21
OpenSoucre
阅读(179)
推荐(0)
摘要:
Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front o...
阅读全文
posted @ 2015-07-07 16:09
OpenSoucre
阅读(303)
推荐(0)
摘要:
OpenCV是一个基于(开源)发行的跨平台计算机视觉库,可以运行在Linux、Windows和Mac OS操作系统上。它轻量级而且高效——由一系列 C 函数和少量 C++ 类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法。2.MacOS...
阅读全文
posted @ 2015-04-27 00:05
OpenSoucre
阅读(396)
推荐(0)
摘要:
证明过程参考编程之美2015资格赛题解题目1 :2月19日时间限制:2000ms单点时限:1000ms内存限制:256MB描述给定两个日期,计算这两个日期之间有多少个2月29日(包括起始日期)。只有闰年有2月29日,满足以下一个条件的年份为闰年:1. 年份能被4整除但不能被100整除2. 年份能被4...
阅读全文
posted @ 2015-04-19 20:04
OpenSoucre
阅读(863)
推荐(0)
摘要:
需要修改项目中Rakefile文件的内容:原始内容:system “git push origin #{deploy_branch}”改后内容:system “git push origin +#{deploy_branch}” 多个+号;再次执行rake deploy,至此,我的问题解决,项目可以...
阅读全文
posted @ 2015-01-19 21:17
OpenSoucre
阅读(725)
推荐(0)
摘要:
执行下面这句话即可`rm -rf source/assets/bootstrap/docs/`
阅读全文
posted @ 2015-01-18 13:33
OpenSoucre
阅读(314)
推荐(0)
摘要:
>mac osx 下面用django-admin.py创建项目的时候,没创建成功出现django-admin.py编辑文件,这主要的原因是mac osx下面django-admin.py被重命名为django-admin`django-admin startproject mysite`
阅读全文
posted @ 2015-01-15 16:41
OpenSoucre
阅读(476)
推荐(0)
摘要:
1、安装Xcode command line tools首先,编译mysql和Homebrew需要用到Xcode command line tools,所以首先安装command line tools;如果安装了Xcode,只需要“Preferences… > Downloads”,之后点击Comm...
阅读全文
posted @ 2015-01-14 00:58
OpenSoucre
阅读(3201)
推荐(2)
摘要:
(1)首先查看*.conf 是否有读写权限,如果没有要将文件赋予读写权限,比如sudo chmod 777 localhost.conf(2)再查看/Users/username/Sites/localhost/文件夹是否有index.html文件,没有的话,创建一个,默认是打开index.html...
阅读全文
posted @ 2015-01-12 23:19
OpenSoucre
阅读(2755)
推荐(0)
摘要:
刷题注意的事:1、要经常在白板或者纸上写代码,检查是否漏掉情况,然后键入电脑运行测试写的代码;2、用自己最擅长的语言去练习和面试,一般选择的语言是Java,Python,C,C++;3、在睡觉前回忆一下今天刷的题或者阅读一些面试有关的书籍,研究表明睡前回忆或者阅读有非常好的记忆效果(可以参考论文研究...
阅读全文
posted @ 2015-01-04 13:07
OpenSoucre
阅读(6517)
推荐(2)
摘要:
出现这个问题Some externally hosted files were ignored (use --allow-external PIL to allow)的主要原因是PIL的一些依赖库还没有安装需要先安装PIL的依赖库安装步骤(1)首先通过homebrew安装libtiff,libjpe...
阅读全文
posted @ 2014-12-31 19:07
OpenSoucre
阅读(679)
推荐(0)
摘要:
参考博客 Liam Q博客 和李航的《统计学习方法》感知机学习旨在求出将训练数据集进行线性划分的分类超平面,为此,导入了基于误分类的损失函数,然后利用梯度下降法对损失函数进行极小化,从而求出感知机模型。感知机模型是神经网络和支持向量机的基础。下面分别从感知机学习的模型、策略和算法三个方面来介绍。1....
阅读全文
posted @ 2014-12-25 21:34
OpenSoucre
阅读(1384)
推荐(0)
摘要:
在程序中要添加django.setup()整个程序如下所示import osimport djangodef populate(): python_cat = add_cat('Python') add_page(cat=python_cat, title="Officia...
阅读全文
posted @ 2014-12-25 10:05
OpenSoucre
阅读(4472)
推荐(0)
摘要:
主要是编译时没有添加protobuf库文件g++ -o Writer.o lm.helloworld.pb.cc Writer.cpp -L/usr/local/lib -lprotobuf
阅读全文
posted @ 2014-12-20 20:07
OpenSoucre
阅读(1901)
推荐(0)
摘要:
题意: 一个游戏有n轮,有A和B比赛,谁在第 i 轮得胜,就获得 i 分,给出x,y,问A得x分,B得y分有没有可能,如果有,输出A最少赢的盘数解题思路: 首先判断n(n+1)/2 = (x+y)是否有解,即是否存在n为整数,使得所有分数的和加起来为x+y,即判断n2+n-2(x+y)=0,存在整...
阅读全文
posted @ 2014-12-08 21:17
OpenSoucre
阅读(265)
推荐(0)
摘要:
今天下午面试的很郁闷,自己语速过快,表达不清楚,容易激动,以后要改善。1、反转字符串,保留原先位置的大小写,如 AbCd 反转后为DcBavoid reverseStr(char* str){ if(str == NULL) return; int len = 0; while...
阅读全文
posted @ 2014-10-27 16:53
OpenSoucre
阅读(899)
推荐(1)
摘要:
1、约瑟夫环是一个数学的应用问题:已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围。从编号为k的人开始报数,数到m的那个人出列;他的下一个人又从1开始报数,数到m的那个人又出列;依此规律重复下去,直到圆桌周围的人全部出列.#include #include #include #inc...
阅读全文
posted @ 2014-10-16 14:35
OpenSoucre
阅读(1003)
推荐(0)
摘要:
参考http://www.cnblogs.com/jiabei521/p/3348780.html出的题目1、题目的意思是 1xN的棋盘上,每个格子有一定的分值,现在有m个卡片,每个卡片上有1~4四种数值,代表走几步,类似小时候的飞行棋游戏,现在有个人站在位置0的初始点,抽取一张卡片,然后根据卡片...
阅读全文
posted @ 2014-10-09 10:43
OpenSoucre
阅读(1721)
推荐(0)
摘要:
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
阅读全文
posted @ 2014-10-08 16:44
OpenSoucre
阅读(181)
推荐(0)
摘要:
1、判断三个bool值中是否至少有两个bool为真? 此题有几种不同的解法 (1)传统解法bool leastTwo(bool a, bool b, bool c){ return (a&&b) || (b&&c) || (c&&a);} (2)如果学过电路的可以考虑利用卡诺图化简ret...
阅读全文
posted @ 2014-09-04 11:39
OpenSoucre
阅读(399)
推荐(0)
posted @ 2014-08-21 20:46
OpenSoucre
阅读(185)
推荐(0)
摘要:
A. Laptops题目意思: 给定n台电脑,第i台电脑的价格是ai ,质量是bi,问是否存在一台电脑价格比某台电脑价格底,但质量确比某台电脑的质量高,即是否存在ai bj?解题思路: 这题一定要看题目,a都是1~n的不同数,b也是1~n的不同数,此题只需要判断ai是否等于bi,如果ai!= b...
阅读全文
posted @ 2014-08-10 22:57
OpenSoucre
阅读(426)
推荐(0)
摘要:
第一种方法: 用两重循环对每对点都试一下,然后取最大值即可,时间复杂度为O(n2)#include #include using namespace std;int maxIndexDiff(int a[],int n){ int maxDiff = -1; for(int i = 0...
阅读全文
posted @ 2014-08-05 23:20
OpenSoucre
阅读(2033)
推荐(0)
摘要:
利用expect的,首先查看expect,命令:which expect#!/usr/bin/expect -fspawn ssh 用户名@ip地址expect "assword:"send "password\r"interact自动输入密码,切换目录#!/usr/bin/expect -fspa...
阅读全文
posted @ 2014-08-04 09:50
OpenSoucre
阅读(1312)
推荐(0)
摘要:
GNU的make工作时的执行步骤 (1)读入所有的Makefile (2)读入被include的其它Makefile (3)初始化文件中的变量 (4)推导隐晦规则,并分析所有的规则 (5)为所有的目标文件创建依赖关系链 (6)根据依赖关系,决定哪些目标重新生成 (7)执行生存命令 定...
阅读全文
posted @ 2014-08-03 16:28
OpenSoucre
阅读(955)
推荐(0)
摘要:
A. Little Pony and Crystal Mine水题,每行D的个数为1,3.......n-2,n,n-2,.....3,1,然后打印即可#include #include #include #include using namespace std;int main(){ int...
阅读全文
posted @ 2014-08-02 16:36
OpenSoucre
阅读(693)
推荐(0)
摘要:
A - Game With Sticks题目的意思: n个水平条,m个竖直条,组成网格,每次删除交点所在的行和列,两个人轮流删除,直到最后没有交点为止,最后不能再删除的人将输掉解题思路: 每次删除交点所在的行和列,则剩下n-1行和m-1列,直到行或列被删完为止,最多删除的次数为min(n,m),...
阅读全文
posted @ 2014-07-25 16:03
OpenSoucre
阅读(611)
推荐(0)
摘要:
拿到这个题目大部分人的第一个思路是 在x轴[-1,1],y轴[-1,1]的正方形内随机选取一点。然后判断此点是否在圆内(通过计算此点到圆心的距离)。如果在圆内,则此点即为所求;如果不在,则重新选取直到找到为止。正方形的面积为4,圆的面积为pi,所以正方形内的随机点在圆内的概率是pi/4。 如果对...
阅读全文
posted @ 2014-07-24 19:34
OpenSoucre
阅读(2546)
推荐(0)
摘要:
1、在半径为1的圆中随机选取一点。2、给定一个未知长度的整数流,如何随机选取一个数3、给定一个数据流,其中包含无穷尽的搜索关键字(比如,人们在谷歌搜索时不断输入的关键字)。如何才能从这个无穷尽的流中随机的选取1000个关键字?
阅读全文
posted @ 2014-07-24 17:28
OpenSoucre
阅读(378)
推荐(0)
摘要:
先用dfs搜索所有的情况,然后判断每种情况是不是括号匹配#include #include #include #include #include #include #include #include #include #include #include #include #include #incl...
阅读全文
posted @ 2014-07-24 10:54
OpenSoucre
阅读(244)
推荐(0)
摘要:
题目比较简单。注意看测试用例2,给的提示Please note that this is the largest possible return value: whenever there is a solution, there is a solution that uses at most tw...
阅读全文
posted @ 2014-07-23 11:32
OpenSoucre
阅读(292)
推荐(0)
摘要:
A - Jzzhu and Children找到最大的ceil(ai/m)即可#include #include using namespace std;int main(){ int n,m; cin >> n >> m; double a, maxv = 0; int m...
阅读全文
posted @ 2014-07-20 13:34
OpenSoucre
阅读(598)
推荐(0)
摘要:
目录结构 由于最近上不了google,而且goagent也不行了,故百度了一下,看到红杏感觉不错 可以先去红杏,然后按方向键向右,直到最后 然后点击方向键向下按照步骤即可 目前感觉速度很快,看youtube都不卡
阅读全文
posted @ 2014-07-18 11:44
OpenSoucre
阅读(164)
推荐(0)