E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Subsequence
华为OD机考-字符串子序列II-字符串(JAVA 2025B卷)
importjava.util.Scanner;publicclass
SubSequence
LastIndex{publicstaticvoidmain(String[]args){Scannersc=
小猫咪怎么会有坏心思呢
·
2025-06-26 00:48
华为机考
java
华为od
开发语言
P3131 [USACO16JAN]
Subsequence
s Summing to Sevens S
难度:普及−;题意:数据范围:1≤N≤500001\leN\le500001≤N≤50000,0≤ai≤10000000\lea_i\le10000000≤ai≤1000000。给定nnn个数,求一段区间和是777的倍数,找出这一段的长度是为多少,如果不存在输出000。分析:很快就想到的是前缀和+暴力枚举O(n2)O(n^2)O(n2),枚举区间的起点和终点[l,r][l,r][l,r],并判断区
spiderwiner
·
2025-06-22 18:49
USACO
历年真题题解报告
c++
算法
USACO
Silver
DP刷题练习(五)
文章目录DP刷题练习(五)[115.不同的子序列-力扣(LeetCode)](https://leetcode.cn/problems/distinct-
subsequence
s/)[583.两个字符串的删除操作
Blue.ztl
·
2025-06-16 17:25
写写算法
算法
数据结构
蓝桥杯
动态规划问题案例
除了经典的斐波那契数列(FibonacciNumbers)和最长公共子序列(LongestCommon
Subsequence
,LCS)问题之外,动态规划还可以解决许多经典案例。
柔丽君
·
2025-06-07 13:37
算法题
笔记
动态规划
LCS 问题解释
最长公共子序列问题(LongestCommon
Subsequence
),该问题可以表述为,在A,BA,BA,B中找出一段子序列xxx,使得xxx既是AAA的子序列,又是BBB的子序列。
网络骑士hrg.
·
2025-05-31 20:55
c++
经验分享
动态规划
《算法笔记》11.8小节——动态规划专题->总结 问题 D: Coincidence
题目描述Findalongestcommon
subsequence
oftwostrings.输入Firstandsecondlineofeachinputcasecontaintwostringsoflowercasecharactera
圣保罗的大教堂
·
2025-05-21 14:40
《算法笔记》
动态规划
Is
Subsequence
classSolution{public:boolis
Subsequence
(strings,stringt){intlen_s=s.size();intlen_t=t.size();intj=0;for
洞阳
·
2025-05-20 14:08
leetcode
双指针
动态规划
leetcode
双指针
动态规划
哈希
2900. 最长相邻不相等子序列 I
2900.最长相邻不相等子序列I题目链接:2900.最长相邻不相等子序列I代码如下:classSolution{public:vectorgetLongest
Subsequence
(vector&words
咔咔咔的
·
2025-05-20 09:05
c++
LeetCode 2900.最长相邻不相等子序列 I:阅读理解题——O(n)一次遍历(贪心)
.最长相邻不相等子序列I:阅读理解题——O(n)一次遍历(贪心)力扣题目链接:https://leetcode.cn/problems/longest-unequal-adjacent-groups-
subsequence
-i
Tisfy
·
2025-05-17 23:56
题解
#
力扣LeetCode
leetcode
算法
题解
贪心
240422 leetcode exercises
leetcode.cn/problems/delete-node-in-a-linked-list/)节点覆盖法[392.判断子序列](https://leetcode.cn/problems/is-
subsequence
良木林
·
2025-04-23 02:58
LeetCode
leetcode
算法
动态规划
Longest Continuous Increasing
Subsequence
Givenanunsortedarrayofintegers,findthelengthoflongestcontinuousincreasing
subsequence
(subarray).Example1
小·幸·运
·
2025-04-20 22:17
Leetcode题解
动态规划
最长不下降子序列
Longest Continuous Increasing
Subsequence
python
给定无序整数数组,计算最长连续递增子序列的长度classSolution(object):deffindLengthOfLCIS(self,nums):""":typenums:List[int]:rtype:int"""count=1maxcount=1iflen(nums)==0:return0foriinrange(1,len(nums)):ifnums[i]>nums[i-1]:count
Adamoptimization
·
2025-04-20 22:46
leetcode
leetcode
python
Longest Continuous Increasing
Subsequence
(最长连续递增子序列)
Givenanunsortedarrayofintegersnums,returnthelengthofthelongestcontinuousincreasing
subsequence
(i.e.subarray
蓝羽飞鸟
·
2025-04-20 22:46
leetcode
算法
leetcode
Longest Continuous Increasing
Subsequence
文章作者:Tyan博客:noahsnail.com|CSDN|简书1.Description2.SolutionclassSolution{public:intfindLengthOfLCIS(vector&nums){intmax_length=0;if(nums.size()nums[i-1]){length++;}else{length=1;}max_length=max(max_lengt
SnailTyan
·
2025-04-20 22:16
Leetcode
Leetcode
⭐算法OJ⭐字符串与数组【动态规划 DP】(C++实现)最长公共子序列 LCS + 最短公共超序列 SCS
文章目录1143.LongestCommon
Subsequence
问题描述解题思路C++实现1092.ShortestCommonSupersequence解题思路C++
Vitalia
·
2025-04-05 05:20
算法OJ
算法
动态规划
c++
代码随想录算法训练营第二十五天 | 491. 非递减子序列、46. 全排列、47.全排列 II、332. 重新安排行程、51. N 皇后、37. 解数独
491.非递减子序列题目链接:https://leetcode.cn/problems/non-decreasing-
subsequence
s/description/文档讲解:https://programmercarl.com
榛果咖啡有点苦
·
2025-03-26 18:22
代码随想录算法训练营
算法
[AtCoder Regular Contest 125] A-F全题解
文章目录A-DialUpB-SquaresC-LIStoOriginalSequenceD-Unique
Subsequence
E-SnackF-TreeDegreeSubsetSum网址链接A-DialUp
ikrvxt
·
2025-03-19 08:34
结论和构造
DP
构造
网络流
dp
分块
数学
LeetCode 376. 摆动序列 java题解
https://leetcode.cn/problems/wiggle-
subsequence
/description/只要不满足摆动条件,就不更新count和prediff当prevDiff取等号时,
奔跑的废柴
·
2025-03-13 10:45
LeetCode
leetcode
java
算法
贪心
贪心算法
LeetCode刷题实战522:最长特殊序列 II
今天和大家聊的问题叫做最长特殊序列II,我们先来看题面:https://leetcode-cn.com/problems/longest-uncommon-
subsequence
-ii/Givenanarrayof
编程IT圈
·
2025-03-11 06:41
字符串
算法
leetcode
java
数据结构
【超详细】动态规划子序列问题总结
子数组是连续的子序列,视为特殊的子序列问题子序列最长递增子序列300.最长递增子序列-力扣(LeetCode)https://leetcode.cn/problems/longest-increasing-
subsequence
周玄九
·
2025-02-28 02:41
动态规划
算法
Leetcode 712. Minimum ASCII Delete Sum for Two Strings
returnthelowestASCIIsumofdeletedcharacterstomaketwostringsequal.AlgorithmDynamicProgramming(DP):similarasLongestCommon
Subsequence
小白菜又菜
·
2025-02-17 06:44
Leetcode
解题报告
动态规划(DP)
leetcode
算法
力扣动态规划-24【算法学习day.118】
.和为目标值的最长子序列的长度题目链接:2915.和为目标值的最长子序列的长度-力扣(LeetCode)题面:附上大佬代码:classSolution{publicintlengthOfLongest
Subsequence
南宫生
·
2025-02-13 04:46
算法
#
动态规划
算法
leetcode
动态规划
学习
java
Day25 非递减子序列 全排列 全排列 II
LeetCode)超时是因为res.contains(path)耗时先搜索所有结果之后判断结果是否有序LinkedListpath=newLinkedList>res=newArrayList>find
Subsequence
s
落叶过河
·
2025-02-10 06:21
代码随想录算法打卡
数据结构
算法
华为OD机试常见类型题目的C++ 代码实现(二)
include#includeusingnamespacestd;//函数功能:计算两个序列的最长公共子序列的长度//参数seq1:第一个序列//参数seq2:第二个序列intlongestCommon
Subsequence
请向我看齐
·
2025-01-25 22:38
c和指针
华为od
c++
开发语言
Number of Longest Increasing
Subsequence
(Java版; Meidum)
welcometomyblogLeetCode673.NumberofLongestIncreasing
Subsequence
(Java版;Meidum)题目描述Givenanunsortedarrayofintegers
littlehaes
·
2024-09-16 02:30
字符串
动态规划
算法
leetcode
数据结构
LeetCode 2207. 字符串中最多数目的子字符串
题目链接:力扣https://leetcode-cn.com/problems/maximize-number-of-
subsequence
s-in-a-string/【分析】由于pattern中只有两个字符
Sasakihaise_
·
2024-09-14 04:25
LeetCode
leetcode
后缀和
动态规划算法之最长公子序列详细解读(附带Java代码解读)
最长公共子序列(LongestCommon
Subsequence
,LCS)问题是动态规划中另一个经典问题,广泛用于比较两个序列的相似度。
南城花随雪。
·
2024-09-10 18:22
算法分析
算法
动态规划
java
C语言 | Leetcode C语言题解之第392题判断子序列
题目:题解:boolis
Subsequence
(char*s,char*t){intn=strlen(s),m=strlen(t);intf[m+1][26];memset(f,0,sizeof(f))
DdddJMs__135
·
2024-09-09 06:30
分享
C语言
Leetcode
题解
代码随想录算法训练营Day22 | 491.递增子序列,46.全排列,47.全排列 II ,332. 重新安排行程,51. N皇后,37. 解数独,总结
代码随想录视频讲解:回溯算法精讲,树层去重与树枝去重|LeetCode:491.递增子序列_哔哩哔哩_bilibili#491classSolution:deffind
Subsequence
s(self
Yummy Penguin
·
2024-09-09 06:00
算法
C++ | Leetcode C++题解之第392题判断子序列
题目:题解:classSolution{public:boolis
Subsequence
(strings,stringt){intn=s.size(),m=t.size();vector>f(m+1,vector
Ddddddd_158
·
2024-09-09 00:53
经验分享
C++
Leetcode
题解
浙大数据结构:01-复杂度2 Maximum
Subsequence
Sum
数据结构MOOCPTA习题01-复杂度2Maximum
Subsequence
Sum#includeusingnamespacestd;constintM=100005;inta[M];intmain()
_Power_Y
·
2024-09-05 22:31
数据结构浙大
数据结构
c++
Java | Leetcode Java题解之第392题判断子序列
题目:题解:classSolution{publicbooleanis
Subsequence
(Strings,Stringt){intn=s.length(),m=t.length();int[][]f
m0_57195758
·
2024-09-04 06:11
分享
Java
Leetcode
题解
C++ | Leetcode C++题解之第392题判断子序列
题目:题解:classSolution{public:boolis
Subsequence
(strings,stringt){intn=s.size(),m=t.size();vector>f(m+1,vector
Ddddddd_158
·
2024-09-04 06:40
经验分享
C++
Leetcode
题解
Sum of
Subsequence
Widths
LeetCode:891.Sumof
Subsequence
Widths题目描述GivenanarrayofintegersA,considerallnon-empty
subsequence
sofA.ForanysequenceS
杨领well
·
2024-08-30 01:58
LeetCode
LeetCode
Weekly
Contest
98
杨领well的
LeetCode
题解专栏
Sum of
Subsequence
Widths
题目描述891.子序列宽度之和AC代码将数组A从小到大排序。假如我们固定了当前子序列的最小值A[i],假设数组下标从0开始,则以A[i]为最小值贡献的答案为,(A[n−1]−A[i])2n−i−2+(A[n−2]−A[i])2n−i−3+⋯+(A[i+1]−A[i])20(A[n−1]−A[i])2^n−i−2+(A[n−2]−A[i])2^n−i−3+⋯+(A[i+1]−A[i])2^0(A[n
NayelyAA
·
2024-08-30 01:26
leetcode
Sum of
Subsequence
Widths 子序列宽度之和
GivenanarrayofintegersA,considerallnon-empty
subsequence
sofA.ForanysequenceS,letthewidthofSbethedifferencebetweenthemaximumandminimumelementofS.Returnthesumofthewidthsofall
subsequence
sofA.Astheanswerma
weixin_30568591
·
2024-08-30 01:56
python
数据结构与算法
Sum of
Subsequence
Widths (找规律)
GivenanarrayofintegersA,considerallnon-empty
subsequence
sofA.ForanysequenceS,letthewidthofSbethedifferencebetweenthemaximumandminimumelementofS.Returnthesumofthewidthsofall
subsequence
sofA.Astheanswerma
HuangHongkai_
·
2024-08-30 01:25
算法
LeetCode
数学
Sum of
Subsequence
Widths - Python
问题描述:891.子序列宽度之和给定一个整数数组A,考虑A的所有非空子序列。对于任意序列S,设S的宽度是S的最大元素和最小元素的差。返回A的所有子序列的宽度之和。由于答案可能非常大,请返回答案模10^9+7。示例:输入:[2,1,3]输出:6解释:子序列为[1],[2],[3],[2,1],[2,3],[1,3],[2,1,3]。相应的宽度是0,0,0,1,1,2,2。这些宽度之和是6。提示:1<
GrowthDiary007
·
2024-08-30 01:23
算法
Python
LeetCode
算法
Python
LeetCode
算法题:拼接最大数
请你利用这两个数组中的数字中创建一个长度为k0){result=merged;}}returnresult;}functiongetMax
Subsequence
(nums,k){letstack=[];
小熊在奋斗
·
2024-08-28 18:52
算法
javascript
python
贪心算法
回文子串问题梳理
https://leetcode.cn/problems/palindromic-substrings/https://leetcode.cn/problems/longest-palindromic-
subsequence
灵海之森
·
2024-08-28 16:09
算法
python
leetcode打卡#day52-58 1143. 最长公共子序列、1035. 不相交的线、53. 最大子数组和、392. 判断子序列
1143.最长公共子序列classSolution{public:intlongestCommon
Subsequence
(stringtext1,stringtext2){vector>dp(text1
小吴同学(wlx)
·
2024-08-26 19:44
leetcode
算法
Longest Max Min
Subsequence
原题链接:Problem-D-Codeforces题意:多测,每次给出长度为n的数组,要求找出没有重复元素的,最长的子序列,如果不止一个最长子序列,那么就选择字典序最小的,比较字典序的时候,如果这个元素的下标是奇数,那么就变成负数比较。思路:线段树+贪心,观察题意可知,最终的子序列肯定是正负相间的,那么对于奇数位置,这个数越大越好,对于偶数位置,这个数越小越好。那么就可以贪心的考虑这个问题,设置二
Jiu-yuan
·
2024-08-26 14:14
算法
数据结构
代码随想录 day29 第七章 回溯算法part05
思路不能改变原数组顺序不能先排序去重同一层去重树枝上可以有重复元素新元素添加条件大于等于当前次收集数组最右元素value>array[right]题解funcfind
Subsequence
s(nums[
厦门奥特曼
·
2024-03-26 14:02
代码随想录
算法
golang
剪枝
算法训练营day46,动态规划14
{ifa>b{returna}returnb}//392.判断子序列//本题与求最长公共子序列相似,区别在于,如果s是t的子序列,那么最长公共子序列的长度等于s的长度,否则s不是t的子序列funcis
Subsequence
weixin_50253985
·
2024-03-12 03:47
算法
动态规划
随想录算法训练营第五十四天|392.判断子序列、115.不同的子序列
392.判断子序列publicclassSolution{publicboolIs
Subsequence
(strings,stringt){if(s.Length==0){returntrue;}intk
萌帅帅小明
·
2024-03-09 08:34
算法
leetcode
动态规划
c#
Atcoder ABC339 E - Smooth
Subsequence
Smooth
Subsequence
(光滑的子序列)时间限制:2s内存限制:1024MB【原题地址】所有图片源自Atcoder,题目译文源自脚本AtcoderBetter!
王老汉
·
2024-02-20 13:53
Java算法题解
算法
java
算法训练营day25(补),回溯5
packagemainimport"sort"491.非递减子序列funcfind
Subsequence
s(nums[]int)[][]int{//存储全部集合result:=make([][]int,
weixin_50253985
·
2024-02-20 00:10
算法
数据结构
go
Longest Common
Subsequence
复盘go多层map嵌套,每层map都要初始化既要写极端小的也要写极端大的用例自底向上,状态,状态转移函数还没写,要搞懂啊画图最长公共子序列LongestCommon
Subsequence
未添加记忆化搜索的伪代码
carlclone
·
2024-02-15 10:22
day29 回溯
解答classSolution{List>res=newArrayListpath=newLinkedList>find
Subsequence
s(in
NHCyrus
·
2024-02-15 05:59
算法
Codeforces 1720D1 Xor-
Subsequence
(easy version)
ProblemLinkThemostapparantsolutiontothisproblemwouldbedynamicprogrammingwithO(n2)\mathcalO(n^2)O(n2)complexity,whereeachfif_ifiwouldtakeO(n)\mathcalO(n)O(n)timetocalculate.Thekeytothisproblemisthedoma
PYL2077
·
2024-02-13 21:44
题解
#Codeforces
动态规划
上一页
1
2
3
4
5
6
7
8
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他