C语言 | Leetcode C语言题解之第391题完美矩形

题目:

题解:

cpp 复制代码
bool isSubsequence(char* s, char* t) {
    int m=strlen(s);  int n=strlen(t);
    int k=0; int j=0;
    if(m==n&&m==0) return true;
    for(int i=0;i<n;i++)
    {
        if(s[j]==t[i])
        {
            j++;
        }
        if(j==m) return true;
    }
    return false;
}
相关推荐
hh随便起个名20 小时前
力扣二叉树的三种遍历
javascript·数据结构·算法·leetcode
xie_pin_an1 天前
深入浅出 C 语言数据结构:从线性表到二叉树的实战指南
c语言·数据结构·图论
LYFlied1 天前
【每日算法】LeetCode 17. 电话号码的字母组合
前端·算法·leetcode·面试·职场和发展
一起养小猫1 天前
LeetCode100天Day1-字符串匹配与Z字形变换
java·leetcode
yaoh.wang1 天前
力扣(LeetCode) 1: 两数之和 - 解法思路
python·程序人生·算法·leetcode·面试·跳槽·哈希算法
Code Slacker1 天前
LeetCode Hot100 —— 滑动窗口(面试纯背版)(四)
数据结构·c++·算法·leetcode
总爱写点小BUG1 天前
打印不同的三角形(C语言)
java·c语言·算法
yaoh.wang1 天前
力扣(LeetCode) 27: 移除元素 - 解法思路
python·程序人生·算法·leetcode·面试·职场和发展·双指针
F_D_Z1 天前
最长连续序列(Longest Consecutive Sequence)
数据结构·算法·leetcode
flashlight_hi1 天前
LeetCode 分类刷题:199. 二叉树的右视图
javascript·算法·leetcode