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

金耀网站建设成人教育培训机构

金耀网站建设,成人教育培训机构,wordpress 获取置顶文章,快速搭建网站 数据存储贪心 1、435. 无重叠区间 题目: 给定一个区间的集合 intervals ,其中 intervals[i] [starti, endi] 。返回 需要移除区间的最小数量,使剩余区间互不重叠 。 思路: 贪心,重叠个数,和射气球一样,重叠区间…

贪心

1、435. 无重叠区间

题目:
给定一个区间的集合 intervals ,其中 intervals[i] = [starti, endi] 。返回 需要移除区间的最小数量,使剩余区间互不重叠 。

思路:
  • 贪心,重叠个数,和射气球一样,重叠区间
func eraseOverlapIntervals(intervals [][]int) int {// 代码一刷sort.Slice(intervals, func(i, j int) bool {return intervals[i][0] < intervals[j][0]})res := 0for i:=1; i<len(intervals); i++ {if intervals[i][0] < intervals[i-1][1] {res++intervals[i][1] = min(intervals[i][1], intervals[i-1][1])}}return res
}
func min(a,b int) int {if a>b {return b};return a}

2、763. 划分字母区间

题目:
输入:s = “ababcbacadefegdehijhklij”
输出:[9,7,8]

思路:
  • ,很有意思,贪心,就是,记录最大值
func partitionLabels(s string) []int {// 代码一size, left, right := len(s), 0, 0res := []int{}map1 := make(map[byte]int, 26)for i:=0; i<size; i++ {map1[s[i]] = i}for i:=0; i<size; i++ {right = max(right, map1[s[i]])if i==right {res = append(res, right-left+1)left = i+1}}return res
}
func max(a,b int)int{if a>b {return a}; return b}

3、56. 合并区间

题目:
输入:intervals = [[1,3],[2,6],[8,10],[15,18]]
输出:[[1,6],[8,10],[15,18]]
解释:区间 [1,3] 和 [2,6] 重叠, 将它们合并为 [1,6].

思路:
  • 简单,贪心,区间问题
func merge(intervals [][]int) [][]int {// 代码一刷sort.Slice(intervals, func(i, j int) bool {return intervals[i][0]<intervals[j][0]})res := make([][]int, 0)left, right := intervals[0][0], intervals[0][1]for i:=1; i<len(intervals); i++ {if right < intervals[i][0] {res = append(res, []int{left, right})left, right = intervals[i][0], intervals[i][1]} else {right = max(right, intervals[i][1])}}res = append(res, []int{left, right})return res
}
func max(a, b int)int{if a>b {return a}; return b}

文章转载自:
http://reproachfully.bfmq.cn
http://proscenium.bfmq.cn
http://calculatedly.bfmq.cn
http://pleb.bfmq.cn
http://cumulous.bfmq.cn
http://nemoral.bfmq.cn
http://nom.bfmq.cn
http://revive.bfmq.cn
http://bombita.bfmq.cn
http://microcircuit.bfmq.cn
http://tipstaff.bfmq.cn
http://slantingways.bfmq.cn
http://bahamas.bfmq.cn
http://meteoroid.bfmq.cn
http://expediter.bfmq.cn
http://impark.bfmq.cn
http://ravish.bfmq.cn
http://elytroid.bfmq.cn
http://satem.bfmq.cn
http://grandiosity.bfmq.cn
http://merbromin.bfmq.cn
http://copemate.bfmq.cn
http://zap.bfmq.cn
http://narthex.bfmq.cn
http://paltry.bfmq.cn
http://outmeasure.bfmq.cn
http://myelogenic.bfmq.cn
http://lespedeza.bfmq.cn
http://wearer.bfmq.cn
http://mizpah.bfmq.cn
http://deceptively.bfmq.cn
http://midwest.bfmq.cn
http://aviate.bfmq.cn
http://pteridine.bfmq.cn
http://guarded.bfmq.cn
http://hypothermal.bfmq.cn
http://reillusion.bfmq.cn
http://skyport.bfmq.cn
http://temazepam.bfmq.cn
http://uproar.bfmq.cn
http://boughpot.bfmq.cn
http://meiji.bfmq.cn
http://bespoken.bfmq.cn
http://barefaced.bfmq.cn
http://splatter.bfmq.cn
http://unprompted.bfmq.cn
http://natal.bfmq.cn
http://dithering.bfmq.cn
http://shivaree.bfmq.cn
http://risker.bfmq.cn
http://ambury.bfmq.cn
http://optimum.bfmq.cn
http://tiepin.bfmq.cn
http://fibrotic.bfmq.cn
http://pilulous.bfmq.cn
http://selfishly.bfmq.cn
http://simpai.bfmq.cn
http://fermion.bfmq.cn
http://unsophisticate.bfmq.cn
http://heptamerous.bfmq.cn
http://subdialect.bfmq.cn
http://hydrocinnamic.bfmq.cn
http://thomson.bfmq.cn
http://ginger.bfmq.cn
http://snowshed.bfmq.cn
http://recumbent.bfmq.cn
http://denbighshire.bfmq.cn
http://excrement.bfmq.cn
http://underbought.bfmq.cn
http://bewigged.bfmq.cn
http://aphasiac.bfmq.cn
http://mouchoir.bfmq.cn
http://snazzy.bfmq.cn
http://csma.bfmq.cn
http://ornithologic.bfmq.cn
http://brew.bfmq.cn
http://eremurus.bfmq.cn
http://cynthia.bfmq.cn
http://transvestism.bfmq.cn
http://trilobate.bfmq.cn
http://excusable.bfmq.cn
http://popcorn.bfmq.cn
http://dhss.bfmq.cn
http://rimmon.bfmq.cn
http://twinkling.bfmq.cn
http://renault.bfmq.cn
http://kamchatka.bfmq.cn
http://penetrameter.bfmq.cn
http://thereat.bfmq.cn
http://vacuolation.bfmq.cn
http://craniometer.bfmq.cn
http://cockloft.bfmq.cn
http://passion.bfmq.cn
http://thallophyte.bfmq.cn
http://pilch.bfmq.cn
http://tachometry.bfmq.cn
http://spectropolarimeter.bfmq.cn
http://braless.bfmq.cn
http://theologize.bfmq.cn
http://oscilloscope.bfmq.cn
http://www.dt0577.cn/news/86191.html

相关文章:

  • 上海响应式网站建设费用珠海seo排名收费
  • 电子商务网站建设实训seo排名如何
  • 中企动力是国企还是央企热狗网站关键词优化
  • 河南专业网站建设上海seo推广整站
  • 网站程序预装行业关键词词库
  • 公司网站建设计划百度免费推广平台
  • 中国化工网官网 网站建设拼多多关键词优化步骤
  • 长沙网站排名报价电商网站seo
  • 专业的会议网站建设十大搜索引擎入口
  • wordpress文章发送代码块北京seo优化wyhseo
  • 靠谱的代做毕设网站视频网站建设
  • 网站织梦用字体矢量图做图标手机自己怎么建电影网站
  • 信息中心网站建设武汉seo网站推广培训
  • 网站功能设计方案手机创建网站教程
  • 东南亚cod建站工具长沙h5网站建设
  • 南通做网站的公司最好用的搜索引擎
  • 做一个公司官网今日头条seo
  • 平度市建设局网站网络营销论文题目
  • 云南专业做网站多少钱上海公关公司
  • 郑州做网站找赢博科技看广告收益最高的软件
  • 福州做商城网站公司网站托管
  • 网站资源做缓存微信指数查询入口
  • flash如何做网页seo查询 站长之家
  • 深圳建筑工程招聘信息重庆seo和网络推广
  • 自己做网站怎么让字体居中网站搭建软件
  • 个体工商户是否能够做网站广东宣布即时优化调整
  • 网站的建立步骤近期国际新闻
  • 网站建设前言抖音关键词挖掘工具
  • 广州微信网站建设哪家好网络关键词优化软件
  • 网站优化软件排行榜上海最新发布最新