
动态规划
喜欢恋着风
这个作者很懒,什么都没留下…
展开
-
583. Delete Operation for Two Strings
Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one character in either string. Example 1: Input: “se原创 2017-05-29 10:22:09 · 663 阅读 · 0 评论 -
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:a) In原创 2017-05-29 10:23:08 · 179 阅读 · 0 评论 -
公共子序列
最长公共子序列给出两个字符串,找到最长公共子序列(LCS),返回LCS的长度。最长公共子序列的定义: 最长公共子序列问题是在一组序列(通常2个)中找到最长公共子序列(注意:不同于子串,LCS不需要是连续的子串)。该问题是典型的计算机科学问题,是文件差异比较程序的基础,在生物信息学中也有所应用。 最长公共子序列定义链接样例 给出”ABCD” 和 “EDCA”,这个LCS是 “A” (或 D或C)原创 2017-05-17 19:33:17 · 463 阅读 · 0 评论 -
TCP协议粗析
1.TCP协议的三次握手和四次挥手其实网络上的传输是没有连接的,包括TCP也是一样的,而TCP所谓的“连接”,其实只不过是在通讯的双方维护一个“连接状态”,让它看上去好像和有连接一样。所以,TCP的状态转换是非常重要的。 图1. TCP状态协议机 图2. TCP三次握手和四次挥手时序图要弄清楚TCP建立连接需要几次交互才行,需要弄清楚建立连接进行初始化的目标是什么。原创 2017-05-31 16:11:40 · 688 阅读 · 0 评论 -
152. Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4], the contiguous subarray [2,3] has the largest produ原创 2017-06-02 17:37:00 · 214 阅读 · 0 评论 -
100层楼2个鸡蛋,如何得知鸡蛋能承受几层的撞击
有一栋楼共100层,一个鸡蛋从第N层及以上的楼层落下来会摔破, 在第N层以下的楼层落下不会摔破。给你2个鸡蛋,设计方案找出N,并且保证在最坏情况下, 最小化鸡蛋下落的次数。 我们先假设最坏情况下,鸡蛋下落次数为x,即我们为了找出N,一共用鸡蛋做了x次试验,那么,我们第一次应该从哪层楼往下扔鸡蛋呢?先让我们假设第一次是在第y层楼扔的鸡蛋,如果第一个鸡蛋第一次扔的时候就摔碎了,我们就剩下一个鸡蛋,要用它原创 2017-08-09 17:57:05 · 608 阅读 · 0 评论