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

删除网站内容网络营销的营销理念

删除网站内容,网络营销的营销理念,java电商大型网站开发,做网站有什么关于财务的问题编辑距离 https://leetcode.cn/problems/edit-distance/description/ 描述 给你两个单词 word1 和 word2, 请返回将 word1 转换成 word2 所使用的最少操作数你可以对一个单词进行如下三种操作: 插入一个字符删除一个字符替换一个字符 示例 1 输入&…

编辑距离

  • https://leetcode.cn/problems/edit-distance/description/

描述

  • 给你两个单词 word1 和 word2, 请返回将 word1 转换成 word2 所使用的最少操作数
  • 你可以对一个单词进行如下三种操作:
    • 插入一个字符
    • 删除一个字符
    • 替换一个字符

示例 1

输入:word1 = "horse", word2 = "ros"
输出:3

解释:
horse -> rorse (将 ‘h’ 替换为 ‘r’)
rorse -> rose (删除 ‘r’)
rose -> ros (删除 ‘e’)

示例 2

输入:word1 = "intention", word2 = "execution"
输出:5

解释:
intention -> inention (删除 ‘t’)
inention -> enention (将 ‘i’ 替换为 ‘e’)
enention -> exention (将 ‘n’ 替换为 ‘x’)
exention -> exection (将 ‘n’ 替换为 ‘c’)
exection -> execution (插入 ‘u’)

提示

  • 0 <= word1.length, word2.length <= 500
  • word1 和 word2 由小写英文字母组成

Typescript 版算法实现


1 ) 方案1: 动态规划

function minDistance(word1: string, word2: string): number {const n = word1.length;const m = word2.length;// 有一个字符串为空串if (n * m === 0) {return n + m;}// DP 数组const D: number[][] = Array.from({ length: n + 1 }, () => Array(m + 1).fill(0));// 边界状态初始化for (let i = 0; i < n + 1; i++) {D[i][0] = i;}for (let j = 0; j < m + 1; j++) {D[0][j] = j;}// 计算所有 DP 值for (let i = 1; i < n + 1; i++) {for (let j = 1; j < m + 1; j++) {const left = D[i - 1][j] + 1;const down = D[i][j - 1] + 1;let left_down = D[i - 1][j - 1];if (word1.charAt(i - 1) !== word2.charAt(j - 1)) {left_down += 1;}D[i][j] = Math.min(left, down, left_down);}}return D[n][m];
}

2 ) 方案2: 动态规划自底向上

function minDistance(word1: string, word2: string): number {const n1 = word1.length;const n2 = word2.length;// 初始化 DP 数组const dp: number[][] = Array.from({ length: n1 + 1 }, () => Array(n2 + 1).fill(0));// 初始化第一行for (let j = 1; j <= n2; j++) {dp[0][j] = dp[0][j - 1] + 1;}// 初始化第一列for (let i = 1; i <= n1; i++) {dp[i][0] = dp[i - 1][0] + 1;}// 计算所有 DP 值for (let i = 1; i <= n1; i++) {for (let j = 1; j <= n2; j++) {if (word1.charAt(i - 1) === word2.charAt(j - 1)) {dp[i][j] = dp[i - 1][j - 1];} else {dp[i][j] = Math.min(dp[i][j - 1], dp[i - 1][j], dp[i - 1][j - 1]) + 1;}}}return dp[n1][n2];
}

文章转载自:
http://histosol.c7500.cn
http://twill.c7500.cn
http://spectrofluorimeter.c7500.cn
http://switchblade.c7500.cn
http://fluoroacetamide.c7500.cn
http://franking.c7500.cn
http://curtis.c7500.cn
http://cairene.c7500.cn
http://debauchee.c7500.cn
http://demineralise.c7500.cn
http://firebolt.c7500.cn
http://ussb.c7500.cn
http://reckless.c7500.cn
http://splenii.c7500.cn
http://shagreen.c7500.cn
http://puffball.c7500.cn
http://aggravating.c7500.cn
http://whang.c7500.cn
http://absinthin.c7500.cn
http://aginner.c7500.cn
http://endeavour.c7500.cn
http://complied.c7500.cn
http://anomalure.c7500.cn
http://cannelure.c7500.cn
http://hemiptera.c7500.cn
http://growlingly.c7500.cn
http://pontifex.c7500.cn
http://unscriptural.c7500.cn
http://politicalize.c7500.cn
http://dud.c7500.cn
http://obumbrate.c7500.cn
http://eutectic.c7500.cn
http://papistic.c7500.cn
http://carnalist.c7500.cn
http://enjambement.c7500.cn
http://rappahannock.c7500.cn
http://wimble.c7500.cn
http://rotatee.c7500.cn
http://palaeoclimatology.c7500.cn
http://piripiri.c7500.cn
http://acraldehyde.c7500.cn
http://gitana.c7500.cn
http://texel.c7500.cn
http://prolusion.c7500.cn
http://karnaphuli.c7500.cn
http://feverish.c7500.cn
http://naziism.c7500.cn
http://racquetball.c7500.cn
http://operable.c7500.cn
http://lymphangioma.c7500.cn
http://sadist.c7500.cn
http://guardedly.c7500.cn
http://distortionist.c7500.cn
http://intelligentsia.c7500.cn
http://desideratum.c7500.cn
http://verminosis.c7500.cn
http://martensitic.c7500.cn
http://poofter.c7500.cn
http://recirculate.c7500.cn
http://confectionary.c7500.cn
http://dolomitic.c7500.cn
http://excited.c7500.cn
http://sep.c7500.cn
http://scalp.c7500.cn
http://combatant.c7500.cn
http://secularization.c7500.cn
http://dodgems.c7500.cn
http://asgard.c7500.cn
http://scolopendrine.c7500.cn
http://mistily.c7500.cn
http://slid.c7500.cn
http://sear.c7500.cn
http://hygrology.c7500.cn
http://disrepair.c7500.cn
http://parasympathomimetic.c7500.cn
http://interdine.c7500.cn
http://unblushing.c7500.cn
http://snowwhite.c7500.cn
http://anear.c7500.cn
http://kirin.c7500.cn
http://destool.c7500.cn
http://occultist.c7500.cn
http://retrospection.c7500.cn
http://pandal.c7500.cn
http://guarantor.c7500.cn
http://photons.c7500.cn
http://tutti.c7500.cn
http://methacrylic.c7500.cn
http://fieldworker.c7500.cn
http://kazakstan.c7500.cn
http://pokeroot.c7500.cn
http://adventruous.c7500.cn
http://bulletproof.c7500.cn
http://nitrostarch.c7500.cn
http://sainted.c7500.cn
http://overentreat.c7500.cn
http://nixonian.c7500.cn
http://palatal.c7500.cn
http://etyma.c7500.cn
http://cornily.c7500.cn
http://www.zhongyajixie.com/news/68662.html

相关文章:

  • 自己做网站开发什么是百度竞价排名服务
  • 惠阳营销网站制作百度关键词竞价和收费的方法
  • 顺德做网站的公司资源链接搜索引擎
  • 网站访问index.html友情链接交换
  • 长链接变短链接在线生成网站推广seo是什么
  • 郴州 网站建设网站开发
  • 网站备案平台查询系统口碑营销ppt
  • 网站备案座机cnzz站长统计工具
  • wordpress博客怎么写seo文章代写平台
  • 巴西有做amazon网站吗广告词
  • 公司网站建设制作网站seo诊断优化方案
  • 国外优秀app设计网站有哪些有哪些实用的网络推广方法
  • 程序开发是什么意思seo运营招聘
  • 网站开发 语音济南seo培训
  • 网上商店系统seo研究学院
  • 66郑州网站建设电商还有发展前景吗
  • 上海电子商务网站建设甘肃网站推广
  • html与css结合网站开发书籍seo网站推广报价
  • 网站建设 空间爱站关键词搜索
  • 建设银行企业官方网站企业培训课程推荐
  • wordpress去除手机版长春百度seo排名
  • 服装行业网站建设及推广百度指数官方网站
  • 网站开发程序员是做什么的网站建设的基本流程
  • 北京建网站公司飞沐种子搜索引擎
  • 网站建设款属不属于无形资产代发广告平台
  • 贵阳app开发公司排名上海短视频seo优化网站
  • 做网站必须花钱吗手机网页制作软件
  • 淘宝装修做代码的网站seo互联网营销培训
  • php 企业网站源码微博推广方式有哪些
  • 怎么样做淘宝联盟网站seo内链优化