2015年11月18日

string的empty,size,length等比较

摘要: 1 #include 2 #include 3 4 using namespace std; 5 6 void Display(const string& str) 7 { 8 cout<<"String: "<<str<<endl; 9 cout<<"Empty: "<<st... 阅读全文

posted @ 2015-11-18 18:19 RenewDo 阅读(2194) 评论(0) 推荐(0) 编辑

Implement strStr()

摘要: 1 class Solution { 2 public: 3 int strStr(string haystack, string needle) { 4 if(haystack.empty()&&!needle.empty()) return -1; 5 ... 阅读全文

posted @ 2015-11-18 18:04 RenewDo 阅读(113) 评论(0) 推荐(0) 编辑

Valid Palindrome

摘要: 注意string也是一个容器可以运用一些容器的方法 1 class Solution { 2 public: 3 bool isPalindrome(string s) { 4 string str; 5 string::iterator first=s.b... 阅读全文

posted @ 2015-11-18 16:23 RenewDo 阅读(94) 评论(0) 推荐(0) 编辑

导航