当前位置:网站首页>0 dynamic planning leetcode1024. Video splicing
0 dynamic planning leetcode1024. Video splicing
2022-07-23 12:53:00 【18 ARU】
analysis
Dynamic programming
dp[i] From 0 To i Seconds requires at least a few pieces of material .dp[i] = Math.min(dp[i],dp[ Left endpoint of a material ]+1);
dp[i] The value concept of is to traverse all the materials containing the current second , Select from 0 To i The material that needs the least material .
class Solution {
public int videoStitching(int[][] clips, int time) {
int[] dp = new int[time+1];
Arrays.fill(dp, time+1);
dp[0] = 0;
for (int i = 1; i <= time; i++) {
for (int j = 0; j < clips.length; j++) {
if (clips[j][0] <= i && clips[j][1] >= i) {
dp[i] = Math.min(dp[i],dp[clips[j][0]]+1);
}
}
}
if (dp[time] > time) {
return -1;
}
return dp[time];
}
}
边栏推荐
- Post form submission data limit
- Unity3d:UGUI源码,Rebuild优化
- 简洁描述raft与paxos在设计上的共同点和不同点
- Hcip--- BGP related configuration
- Hcip --- mGRE comprehensive experiment
- 记一次日志文件IO系统的设计心得
- Explain the establishment of TCP connection in detail
- @Requiredargsconstructor annotation use
- 深度优先找出图中顶点U到顶点V的所有简单路径
- Hcip --- OSPF details
猜你喜欢

深度优先找出图中顶点U到顶点V的所有简单路径

即时通讯WebSocket

学习日记——(路由与交换技术)网络地址转换 NAT技术

How to write a web page with a common text editor

学习日记——(路由与交换技术)OSPF协议

unity3d:Assetbundle模拟加载,同步加载,异步加载,依赖包加载,自动标签,AB浏览器,增量打包

C # custom stack

DNS域名解析服务

Unity3d:ugui, UI and special effect particle level, bakemesh above 2018.2, particles between two images and in Scrollview
![[AUTOSAR storage stack NVM]](/img/7a/15e01f8ace647b55e11e764dba1b64.png)
[AUTOSAR storage stack NVM]
随机推荐
围棋能力概念与软件开发能力概念的对应
学习日记——(路由与交换技术)DHCP(动态主机配置协议)
Analysis of inheritablethreadlocal and Alibaba's transmittablethreadlocal design ideas
Unity3d:UGUI源码,Rebuild优化
超好用的抓包工具tcpdump
HCIP---GRE协议和MGRE环境,以及OSPF协议的相关知识点
C custom queue set
Understand the article frankly and get the HTTP protocol cache
剖析Redis集群
GameFramework:打包资源,打随app发布包,打包生成文件夹说明,上传资源至服务器,下载资源,GameFreamworkList.dat 与GameFrameworkVersion.dat
HCIP---条件匹配和OSPF协议
C#:stack栈源码,数组栈,链栈
读《凤凰架构》- RPC的历史与知识
[AUTOSAR DCM 1. module introduction (DSL, DSD, DSP)]
[AUTOSAR storage stack NVM]
详解各种网络协议
C: stack stack source code, array stack, chain stack
浅析互联网协议(一)
HCIP---BGP相关配置(联邦篇)
InheritableThreadLocal与阿里的TransmittableThreadLocal设计思路解析