题解 | #寻找连续任务开始位置# 字符串查找

寻找连续任务开始位置

https://www.nowcoder.com/practice/c93fd6c526da40788fd832ef9cd7177e

知识点

字符串查找

思路

把words中的字符串拼接起来,在原串中查找即可。

AC Code(C++)

#include <numeric>
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param s string字符串 
     * @param words string字符串vector 
     * @return int整型
     */
    int findLongestSubstring(string s, vector<string>& words) {
        return s.find(accumulate(words.begin(), words.end(), string()));
    }
};

全部评论

相关推荐

点赞 评论 收藏
分享
Java抽象带篮子:简历怎么写可以看看我发的帖子,你的第一个是实习经历吗?那怎么写的是你的第一个练手项目呢?简历写的怎么样直接投小厂面试一下就知道了
没有实习经历,还有机会进...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务