Implement strStr()
来源:互联网 发布:胸肌下轮廓 知乎 编辑:程序博客网 时间:2024/06/05 22:31
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
class Solution {public: int strStr(string haystack, string needle) { int l1=haystack.length(); int l2=needle.length(); if(l2>l1)return -1; for(int i=0;i<=l1-l2;++i) { int bj=0; for(int j=0;j<l2;++j) { if(haystack[i+j]!=needle[j]) { bj=1; break; } } if(bj==0)return i; } return -1; }};
阅读全文
0 0
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- Implement strStr()
- UVA-10129 Play on Words
- ActiveMQ的初步了解
- fresco动画
- 编译ssd至build时全部错误cv::未定义等
- js金额大小写转换
- Implement strStr()
- 神经网络移植到STM32F4上的应用
- 【Java没基础】函数式编程——Stream API 中的收集器
- Linux网络配置
- 浏览器插件
- 135. Candy
- 利用GitHubPages+jekyll+Markdown搭建个人博客
- Divide Two Integers
- jdbc 数据库配置util 及 Properties 设置方法