当前位置: 首页 > news >正文

企拓客软件怎么样sem推广优化

企拓客软件怎么样,sem推广优化,外包公司能去吗,那个网站可以学做西餐tasks for today: 1. 115.不同的子序列 2. 583.两个字符串选的删除操作 3. 72.编辑距离 4. 总结编辑两个序列关系的问题 ------------------------------------------------------------------- 1. 115.不同的子序列 In this practice, it is necessary to compare with t…

tasks for today:

1. 115.不同的子序列

2. 583.两个字符串选的删除操作

3. 72.编辑距离

4. 总结编辑两个序列关系的问题

-------------------------------------------------------------------

1. 115.不同的子序列

In this practice, it is necessary to compare with the practice 392, the essense of practice 392 is finding the length of longest common string, while in this practice, the dp reocrd the times that t[0:j] appears in s[:i];

the essence is the recursive equation and the initialization. 

recursive equation: discerned by if s[i-1] == t[j-1], when true, the dp[i][j] actually consist of two parts, the dp[i-1][j-1] is easy to understand, the dp[i-1][j] is a thinker, this actually include all the nums of condition where t[:j] appears in s section which is shorter thans[s:i].

The initialization's key point is the dp[i][0] = 1 and dp[0][j] = 0, void string t="" is counted as a child string, that is why the dp[i][0] is initialized as 1.

class Solution:def numDistinct(self, s: str, t: str) -> int:if len(s) < len(t): return 0if len(s) >= len(t):if len(t) == 1 and t[0] not in s: return 0dp = [[0] * (len(t)+1) for _ in range(len(s)+1)]for i in range(len(s)):dp[i][0] = 1for i in range(1, len(s)+1):for j in range(1, len(t)+1):if s[i-1] == t[j-1]:dp[i][j] = dp[i-1][j-1] + dp[i-1][j]else:dp[i][j] = dp[i-1][j]return dp[-1][-1]

2. 583.两个字符串选的删除操作

In this practice, the key difference are also lied in the recursive equation and the initialization.

It is intuitive to define the dp[i][j] as the min actions to make word1[:i] and word2[:j] equal.

the essence of the recursive equation is when the word1[i-1] != word2[j-1], the state of dp[i][j] can be derived from the dp[i-1][j] or dp[i][j-1] or dp[i-1][j-1]

class Solution:def minDistance(self, word1: str, word2: str) -> int:dp = [[0] * (len(word2)+1) for _ in range(len(word1)+1)]for i in range(1, len(word1)+1):dp[i][0] = ifor j in range(1, len(word2)+1):dp[0][j] = jfor i in range(1, len(word1)+1):for j in range(1, len(word2)+1):if word1[i-1] == word2[j-1]:dp[i][j] = dp[i-1][j-1]else:dp[i][j] = min(dp[i-1][j-1]+2, dp[i-1][j]+1, dp[i][j-1]+1)return dp[-1][-1]

3. 72.编辑距离

This practice is an extension of practice 583, which allows for more operations other than deleting.

The essense of the recursive equation also lies in the operation of condition "word1[i-1] != word2[j-1]". Be noted that the deleting of word1 is equal to addition on word2, since this practice count the least number of operation, instead of options of operation, so it is ok only choose one apprah.

class Solution:def minDistance(self, word1: str, word2: str) -> int:dp = [[0] * (len(word2)+1) for _ in range(len(word1)+1)]for i in range(1, len(word1)+1):dp[i][0] = ifor j in range(1, len(word2)+1):dp[0][j] = jfor i in range(1, len(word1)+1):for j in range(1, len(word2)+1):if word1[i-1] == word2[j-1]:dp[i][j] = dp[i-1][j-1]else:dp[i][j] = min(dp[i-1][j-1], dp[i-1][j], dp[i][j-1]) + 1return dp[-1][-1]

4. a summary of practice 392/115/583/72

these 4 practices are related to the relationship / edition of two strings or sequence, 

(1) from the configuration:

practice 392/115 discuss the relationship, which 392 concentrated on true/false of containing, while practice 115 focuses on the times of containing.

practice 583/72 dicuss the edition of two lists for making them to achieve a specific requirement such as being same, which 583 concentrates on only using deleting, while 72 allows for more operations such as replacement or addition.

(2) from the code-dp:

392's dp records the max length of common string, while 115 records the times of containing;

583's dp records the delete times, while the 72 records the times of operaaation

(3) from the code-initialization:

all of them need to initialize the dp[i][0] and dp[0][j]

392 update them as 1

115 of update dp[i][0] as 1

583/72 update dp[i][0] as i, while dp[0][j] as j

http://www.hengruixuexiao.com/news/50574.html

相关文章:

  • 外贸业务网络推广seo关键词
  • 网上建站赚钱长沙网站seo推广公司
  • 巴西网站建设浏阳廖主任打人案
  • 深圳做网站优化费用seo兼职怎么收费
  • 网站开发的问题有哪些太原好的网站制作排名
  • 百度网盘做网站百度手机助手app免费下载
  • 海淀商城网站建设2024免费网站推广大全
  • 项目管理工具seo全网营销公司
  • 免费网站建设浩森宇特培训公司
  • 六安政务中心网站专业优化网站排名
  • wordpress 嵌入网址流程优化四个方法
  • 有没有专业做steam创客的网站自动秒收录网
  • 微信小程序平台官网登录入口网站运营推广选择乐云seo
  • wordpress 回复显示西安搜索引擎优化
  • 免费试用网站源码怎么设计一个网页
  • 温州网牌电线电缆有限公司游戏优化大师下载安装
  • 河南省建设执业资格中心网站地推网推平台
  • 开源项目网站怎么做 带视频猪八戒网接单平台
  • h5成品网站无锡谷歌优化
  • 一个简单的个人主页福州短视频seo平台
  • 西安知名的集团门户网站建设公司北京seo公司助力网络营销
  • 网站建设价格是哪些方面决定的万能软文范例800字
  • 什么网站能免费做公众号封面站内推广的方法和工具
  • 有空间与域名 怎么做网站排名优化关键词公司
  • 金融做市场广告挂哪些网站网站整站优化推广方案
  • 做网站用什么软件ps字体武汉网站推广很 棒
  • 哪些网站做代理中国搜索引擎排名2021
  • .net网站开发技术简介属于免费的网络营销方式
  • 做界面网站用什么语言好企业seo网站营销推广
  • 江门网站制作维护java培训机构十强