摘要: 题目:Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"Corner Cases:Did you ... 阅读全文
posted @ 2015-09-16 06:40 Hygeia 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in 阅读全文
posted @ 2015-09-16 05:26 Hygeia 阅读(157) 评论(0) 推荐(0) 编辑
摘要: Q:Implementint sqrt(int x).Compute and return the square root ofx.A:这里给出两种实现方法:一是二分搜索,二是牛顿迭代法。1. 二分搜索对于一个非负数n,它的平方根不会大于(n/2+1)。在[0, n/2+1]这个范围内可以进行二分搜... 阅读全文
posted @ 2015-09-16 05:15 Hygeia 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题目:Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below a... 阅读全文
posted @ 2015-09-16 04:43 Hygeia 阅读(159) 评论(0) 推荐(0) 编辑