摘要: 本文主要参考《unix环境高级编程》sigaction函数的功能是检查或修改与指定信号相关联的处理动作(可同时两种操作)。intsigaction(intsigno,conststructsigaction*restrict act,structsigaction*restrict oact);结构... 阅读全文
posted @ 2015-03-10 17:20 穆穆兔兔 阅读(1756) 评论(0) 推荐(1) 编辑
摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cas... 阅读全文
posted @ 2015-03-10 16:26 穆穆兔兔 阅读(214) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2015-03-10 14:07 穆穆兔兔 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Implementint sqrt(int x).Compute and return the square root ofx.Hide TagsMathBinary Search思路:整体上用2分比逐个比较强。首先,给出一个错误的版本:错误之处在于红色部分,当mid较大时,mid*mid会超过IN... 阅读全文
posted @ 2015-03-10 11:35 穆穆兔兔 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Given an array of words and a lengthL, format the text such that each line has exactlyLcharacters and is fully (left and right) justified.You should p... 阅读全文
posted @ 2015-03-10 10:23 穆穆兔兔 阅读(151) 评论(0) 推荐(0) 编辑