标签错了吧,这不是双指针吗,为什么是DP?
查看原帖
标签错了吧,这不是双指针吗,为什么是DP?
564321
ChaseDream楼主2022/10/25 11:00

RT,题意:求最长子序列

AC代码

#include<bits/stdc++.h>
using namespace std;
string s1,s2;
int ans;
int main(){
	cin>>s1>>s2;
	for(int l=0,r=0;l<s1.size();l++)
		if(s1[l]==s2[r])
			r++,ans++;
	cout<<ans;
	return 0;
}

很水的一题

2022/10/25 11:00
加载中...