摘要:
题目: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 ... 阅读全文
摘要:
题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in 阅读全文
摘要:
Q:Implementint sqrt(int x).Compute and return the square root ofx.A:这里给出两种实现方法:一是二分搜索,二是牛顿迭代法。1. 二分搜索对于一个非负数n,它的平方根不会大于(n/2+1)。在[0, n/2+1]这个范围内可以进行二分搜... 阅读全文
摘要:
题目: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... 阅读全文