您当前的位置: 首页 > 

对方正在debug

暂无认证

  • 5浏览

    0关注

    399博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

包含所有三种字符的子字符串数目(双指针)

对方正在debug 发布时间:2020-02-23 13:48:21 ,浏览量:5

题目:https://leetcode-cn.com/problems/number-of-substrings-containing-all-three-characters/

class Solution {
public:
    int numberOfSubstrings(string s) {
        /*
        *双指针
        *给你一个字符串 s ,它只包含三种字符 a, b 和 c 。
        *请你返回 a,b 和 c 都 至少 出现过一次的子字符串数目
        */
        int n = s.length();
        int num[5];
        memset(num,0,sizeof(num));
        int ans = 0;
        bool flag = 0;
        int pos;
        int j = 0;
        for(int i = 0;i             
关注
打赏
1664895754
查看更多评论
0.0349s