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

网站开发一个多少钱啊网络营销策略方案

网站开发一个多少钱啊,网络营销策略方案,德阳做网站,网络公司做网站服务器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.tj-hxxt.cn/news/62504.html

相关文章:

  • 湖南网站设计公司网络营销整合推广
  • 自媒体人专用网站google推广工具
  • 企业做自己的网站要注意什么全球搜钻是什么公司
  • 网站建设价格标准关键词优化搜索引擎
  • 苏州关键词网站排名电商运营工作内容
  • 做网站记者好吗建站abc网站
  • 太原做微网站的公司百度收录域名
  • 深圳网站专业制作株洲seo优化报价
  • 做淘宝客没网站怎么做关键词歌曲歌词
  • 古色古香的网站模板平台接广告在哪里接的
  • 网站测试设计重庆网站快速排名提升
  • 七宝做网站百度怎么发帖做推广
  • 建设企业网站方法怎么做一个自己的网站
  • 辽河油田建设有限公司网站百度seo刷排名网址
  • 政府网站模板济南优化网络营销
  • 淄博网站设计公司二维码引流推广的平台
  • 商城网站制作百度关键字
  • 出格做网站怎么样买链接网站
  • 建设一个聊天类的网站百度竞价产品
  • 购物平台如何推广如何优化seo
  • 成都网络公司优惠政策优化人员是什么意思
  • 怎么在社保网站上做员工减少东莞seo优化
  • 绵阳个人网站建设如何快速推广自己的产品
  • 电商数据平台网站搜索引擎优化方案
  • 长沙建站费用最新seo网站优化教程
  • 非法期货做网站搜索引擎优化的内容包括
  • 旅游网站建设的相关报价外贸建站优化
  • 做网站建设的网站百度推广电话销售好做吗
  • 网站设计ps做效果图过程最近有哪些新闻
  • 赤水网站建设宁波免费seo排名优化