摘要: ```C++ class Solution { public: bool isValid(string s) { vector stack; map bra; bra[')'] = '('; bra['}'] = '{'; bra[']'] = '['; for(int i=0;i 阅读全文
posted @ 2018-07-26 20:07 一条图图犬 阅读(319) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: int firstUniqChar(string s) { map a; for(auto c:s){ if(!a.count(c)){ a[c] = 1; } else{ a[c]++; } } for(int i=0;i 阅读全文
posted @ 2018-07-26 19:30 一条图图犬 阅读(157) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: bool repeatedSubstringPattern(string s) { string ss = s + s; string ss_(ss.begin() + 1, ss.end() 1); return (ss_.find( 阅读全文
posted @ 2018-07-26 18:25 一条图图犬 阅读(383) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: bool canConstruct(string ransomNote, string magazine) { map r; map m; for(auto i:ransomNote){ if(r[i]==0){ r[i]... 阅读全文
posted @ 2018-07-26 17:35 一条图图犬 阅读(266) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: string reverseVowels(string s) { set vow = {'a', 'e', 'o', 'i', 'u', 'A', 'E', 'I', 'O', 'U'}; auto left = s.begin(); 阅读全文
posted @ 2018-07-26 17:04 一条图图犬 阅读(145) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: string addBinary(string a, string b) { string res = ""; int c = 0; int i = a.size() - 1; int j = b.size() - 1; while(i >= 0 ... 阅读全文
posted @ 2018-07-26 16:27 一条图图犬 阅读(610) 评论(1) 推荐(0) 编辑
摘要: ```C++ include include include class Solution { public: int countBinarySubstrings(string s) { if(s.empty() || s.size() == 1){ std::cout heap_vec; int 阅读全文
posted @ 2018-07-26 16:02 一条图图犬 阅读(250) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: string reverseWords(string s) { auto st = s.begin(); for(auto i = s.begin();i 阅读全文
posted @ 2018-07-26 13:20 一条图图犬 阅读(410) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: bool judgeCircle(string moves) { int x = 0; int y = 0; for(auto c:moves){ if(c=='U'){ y++; } ... 阅读全文
posted @ 2018-07-26 11:55 一条图图犬 阅读(222) 评论(0) 推荐(0) 编辑
摘要: ```C++ class Solution { public: string toLowerCase(string str) { for(int i=0;i= 'A' && str[i] 阅读全文
posted @ 2018-07-26 11:34 一条图图犬 阅读(389) 评论(0) 推荐(0) 编辑
摘要: ```C++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: bool ... 阅读全文
posted @ 2018-07-26 11:04 一条图图犬 阅读(191) 评论(0) 推荐(0) 编辑
摘要: ```C++ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListN... 阅读全文
posted @ 2018-07-26 10:36 一条图图犬 阅读(260) 评论(0) 推荐(0) 编辑