- 博客(7)
- 收藏
- 关注
原创 (Java)LeetCode-72. Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:
2016-11-09 17:03:29 525
原创 (Java)LeetCode-71. Simplify Path
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 consider the case where path
2016-11-09 10:29:53 366
原创 (Java)LeetCode-70. Climbing Stairs
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 climb to the top?这道题是一个比较经典比较简单的问题。
2016-11-06 16:01:21 633
原创 (Java)LeetCode-69. Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.这道题么,当然最简单的方法就是一行代码 return(int)Math.sqrt(x);不过出于强迫症,还是用二分法又写了一遍代码。需要注意的地方是循环应该是while(left public int mySq
2016-11-03 16:02:19 595
原创 (Java)LeetCode-68. Text Justification
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 should pack your words in a greedy approach; that i
2016-11-02 22:37:03 363
原创 (Java)LeetCode-67. Add Binary
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".这道题也是木有什么难度,总体来说和上一题很像。从后向前遍历一遍即可。注意有进位的情况。public String addBinary(S
2016-11-02 17:01:53 414
原创 (Java)LeetCode-66. Plus One
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 the head of the list.这道题题意刚开始没看明白。。
2016-11-02 15:03:05 791
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人