![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
cookcoder
这个作者很懒,什么都没留下…
展开
-
word pattern
class Solution { public: bool wordPattern(string pattern, string str) { int p_len =pattern.size(); vector word ; int t=0; for(int i=0;i<str.size();i++) if (str[i]==' '){ string ww=s原创 2015-11-03 22:13:40 · 337 阅读 · 0 评论 -
TwoSum
#include #include #include #include using namespace std; //先对原始数组进行排序,建立一个新的Id vector存储各个元素排序之前的序号, //对小于target的部分用for循环判断是否为twosum和 class Solution { public: vector twoSum(vector& nums, i原创 2015-11-06 19:44:45 · 416 阅读 · 1 评论 -
ZigZag Convertion
#include #include #include #include using namespace std; //从按行的角度出发,计算逐个需要存的字符的对应原串的下标。 class Solution { public:Za string convert(string s, int numRows) { string re= ""; int len =s.size原创 2015-11-06 21:53:07 · 308 阅读 · 0 评论 -
Reverse Interger
#include #include #include #include using namespace std; //从按行的角度出发,计算逐个需要存的字符的对应原串的下标。 class Solution { public: int reverse(int x) { if(x==0) return x; int bit原创 2015-11-08 13:17:32 · 296 阅读 · 0 评论 -
strStr()
#include #include #include #include using namespace std; //从按行的角度出发,计算逐个需要存的字符的对应原串的下标。 class Solution { public: int strStr(string haystack,string needle) { int i,j; // cout << needle.size(原创 2015-11-17 19:28:37 · 267 阅读 · 0 评论 -
Reverse Words in a String
#include #include #include #include #include #include using namespace std; class Solution { public: string reverseWords(string str) { if (str == "") return str; else { int i = 0; int j原创 2015-11-17 21:53:36 · 354 阅读 · 0 评论