摘要: 题目: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 hav... 阅读全文
posted @ 2015-09-25 11:37 Hygeia 阅读(220) 评论(0) 推荐(0) 编辑
摘要: Given two strings, find the longest common substring.Return the length of it.ExampleGiven A = "ABCD", B = "CBCE", return 2.NoteThe characters in subst... 阅读全文
posted @ 2015-09-25 11:04 Hygeia 阅读(232) 评论(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-09-25 10:33 Hygeia 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * 本代码由九章算法编辑提供。没有版权欢迎转发。 3 * - 九章算法致力于帮助更多中国人找到好的工作,教师团队均来自硅谷和国内的一线大公司在职工程师。 4 * - 现有的面试培训课程包括:九章算法班,系统设计班,BAT国内班 5 * - 更多详情请见官方网站:http:/... 阅读全文
posted @ 2015-09-25 06:10 Hygeia 阅读(398) 评论(0) 推荐(0) 编辑
摘要: 题目:Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,7,1,2,3,4].Note:Try to c... 阅读全文
posted @ 2015-09-25 01:43 Hygeia 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 方法一: reverse ArrayList1 private void reverse(ArrayList nums, int start, int end) {2 for (int i = start, j = end; i < j; i++, j--) {3 ... 阅读全文
posted @ 2015-09-25 01:04 Hygeia 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a rotated sorted array, recover it to sorted array in-place.Example[4, 5, 1, 2, 3] -> [1, 2, 3, 4, 5]ChallengeIn-place, O(1) extra space and ... 阅读全文
posted @ 2015-09-25 00:52 Hygeia 阅读(125) 评论(0) 推荐(0) 编辑