2014年9月6日

【转】程序员面试100题之七:最长公共子字符串

摘要: 子字符串的定义和子序列的定义类似,但要求是连续分布在其他字符串中。比如输入两个字符串BDCABA和ABCBDAB的最长公共字符串有BD和AB,它们的长度都是2。 最长公共子字符串共有两种解决方法,下面具体说说我的思路方法一: Longest Common Substring和Longest Comm... 阅读全文

posted @ 2014-09-06 21:22 bug睡的略爽 阅读(54) 评论(0) 推荐(0) 编辑

【转】程序员面试100题之六:最长公共子序列

摘要: 题目:如果字符串一的所有字符按其在字符串中的顺序出现在另外一个字符串二中,则字符串一称之为字符串二的子串。注意,并不要求子串(字符串一)的字符必须连续出现在字符串二中。请编写一个函数,输入两个字符串,求它们的最长公共子序列,并打印出最长公共子序列。 例如:输入两个字符串BDCABA和ABCBDA... 阅读全文

posted @ 2014-09-06 21:20 bug睡的略爽 阅读(104) 评论(0) 推荐(0) 编辑

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 阅读全文

posted @ 2014-09-06 21:05 bug睡的略爽 阅读(125) 评论(0) 推荐(0) 编辑

Sqrt(x)

摘要: Implement int sqrt(int x). Compute and return the square root of x. 传说中的牛顿法,请查看百度百科 某人说我偷懒,那我就决定还是翻些资料出来比较好。。。 牛顿法主要用于两方面,一是求方程根,二是最优化处理。 求方程根的原理是利用泰勒 阅读全文

posted @ 2014-09-06 20:30 bug睡的略爽 阅读(186) 评论(0) 推荐(0) 编辑

Median of Two Sorted Arrays

摘要: There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be 阅读全文

posted @ 2014-09-06 16:50 bug睡的略爽 阅读(137) 评论(0) 推荐(0) 编辑

导航