首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
统计子序列数
[编程题]统计子序列数
热度指数:465
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
给定两个字符串 s 和 t ,请问 s 有多少个子序列等于 t 。
s 的子序列指从 s 中删除任意位置任意个字符留下的字符串。
数据范围: 两个字符串的长度都满足
,两个字符串都仅包含小写英文字母,且结果一定在
之内
示例1
输入
"noowcoder","nowcoder"
输出
2
说明
可以删除第二个或第三个
示例2
输入
"nowcooder","nowwcoder"
输出
0
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(0)
邀请回答
收藏(12)
分享
纠错
提交结果有问题?
1个回答
2篇题解
开通博客
17c89
发表于 2024-08-19 14:44:21
import java.util.*; /** * NC397 统计子序列数 * @author d3y1 */ public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * *
展开全文
17c89
发表于 2024-08-19 17:13:41
import java.util.*; /** * NC397 统计子序列数 * @author d3y1 */ public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * *
展开全文
问题信息
动态规划
难度:
1条回答
12收藏
1084浏览
热门推荐
通过挑战的用户
查看代码
威化饼的一隅
2022-09-15 10:26:56
江三03
2022-09-07 16:38:14
西方不胜
2022-09-07 10:57:19
chen_bug
2022-08-15 10:10:03
半个西瓜半个夏
2022-08-09 21:23:47
相关试题
请画出在包含 14 个结点的二项堆...
高级算法
评论
(1)
如图 1 表示使用快表(页表)的虚...
编程基础
评论
(1)
对于我们来说,谁是好的顾客?
销售常识
评论
(1)
小红书用户在不同使用场景下,对内容...
需求分析
评论
(1)
订单表order_table全部记...
查找
数据库
数据分析
SQL
评论
(1)
统计子序列数
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ public int countSubseq (String s, String t) { // write code here } }
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ int countSubseq(string s, string t) { // write code here } };
#coding:utf-8 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param s string字符串 # @param t string字符串 # @return int整型 # class Solution: def countSubseq(self , s , t ): # write code here
using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ public int countSubseq (string s, string t) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ function countSubseq( s , t ) { // write code here } module.exports = { countSubseq : countSubseq };
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param s string字符串 # @param t string字符串 # @return int整型 # class Solution: def countSubseq(self , s: str, t: str) -> int: # write code here
package main import "fmt" /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ func countSubseq( s string , t string ) int { // write code here }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ int countSubseq(char* s, char* t ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param s string字符串 # @param t string字符串 # @return int整型 # class Solution def countSubseq(s, t) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ def countSubseq(s: String,t: String): Int = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ fun countSubseq(s: String,t: String): Int { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ public int countSubseq (String s, String t) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ export function countSubseq(s: string, t: string): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ func countSubseq ( _ s: String, _ t: String) -> Int { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @param t string字符串 * @return int整型 */ pub fn countSubseq(&self, s: String, t: String) -> i32 { // write code here } }
"noowcoder","nowcoder"
2
"nowcooder","nowwcoder"
0