01 2015 档案
摘要:class Solution {public: int titleToNumber(string s) { int len = s.length(); if(len == 0) { return 0; } retur...
阅读全文
摘要:class Solution {public: int trailingZeroes(int n) { int count = 0; while (n) { count += n / 5; n /= 5; }...
阅读全文
摘要:select if(count(salary) = 0, NULL, salary) as `salary` from (select salary from Employee group by salary order by salary desc limit 1,1) tmpWrite a S...
阅读全文
摘要:SELECT FirstName, LastName, City, State FROM Person pLEFT JOIN Address a ON p.PersonId = a.PersonId居然出SQL的题目了,左连接就行
阅读全文
摘要:class BSTIterator {private: TreeNode* current; stack nodeStack;public: BSTIterator(TreeNode *root) { current = root; } /** @retu...
阅读全文
摘要:使用引号包裹变量在《高级Bash脚本编程指南》中的4.1节中有这么个例子:hello="A B C D"echo $hello # A B C Decho "$hello" # A B C D当时觉得不可思议,对于第二个echo应该是非常好理解的,而第一个echo为什么会把原来变量中...
阅读全文
摘要:可以使用readlink命令必须加上-f参数,readlink用于读取链接文件所指向的文件,这样对于一些建立了软连接的脚本文件的话非常适用,而对于一般的脚本文件需要加上-f参数否则readlink文件不会有输出(如果不加-f参数对一个普通文件适用readlink命令则$?=1)获取当前执行脚本文件路...
阅读全文
摘要:一、数组声明:int[] x;int x[];在Java中一般使用前者,机把int[]看做一个类型,C++中只能后者二、数组初始化:直接提供值:int[] x = {1, 3, 4};int[][] y = { {1, 2, 3}, ...
阅读全文
摘要:在SQL中使用count()好像是非常自然的事情:SELECT COUNT(*) FROM TABLE_NAME;有时候确实会想过,count(*)和单独的count(column_name)有什么区别,会不会后者效率更好(太拿衣服。。。),不过一直没有去追究。Chapter 6:Query Per...
阅读全文