摘要: Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"解题思路:首先要了解linux目录的... 阅读全文
posted @ 2015-05-16 19:56 TonyLuis 阅读(147) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you cli... 阅读全文
posted @ 2015-05-16 19:32 TonyLuis 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x).Compute and return the square root of x.解题思路一: public int mySqrt(int x) { return (int)Math.sqrt(x); }神奇般的Accept... 阅读全文
posted @ 2015-05-16 19:27 TonyLuis 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You shoul... 阅读全文
posted @ 2015-05-16 18:29 TonyLuis 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".解题思路:JAVA实现如下:static public String addBinar... 阅读全文
posted @ 2015-05-16 11:56 TonyLuis 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2015-05-16 11:08 TonyLuis 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for t... 阅读全文
posted @ 2015-05-16 10:56 TonyLuis 阅读(226) 评论(0) 推荐(0) 编辑
摘要: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.N... 阅读全文
posted @ 2015-05-16 10:19 TonyLuis 阅读(117) 评论(0) 推荐(0) 编辑