
字符串
文章平均质量分 51
Coding_Reading
待我编码有成 娶你为妻可好
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leetcode125. Valid Palindrome
easy程度题题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."rac原创 2017-04-23 12:32:03 · 333 阅读 · 0 评论 -
leetcode28. Implement strStr()
easy程度题题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.字符串匹配,暴力匹配复杂度O(M * N)AC解:class Solution {public原创 2017-04-24 09:51:34 · 414 阅读 · 0 评论 -
leetcode8. String to Integer (atoi)
medium程度题题目:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are t原创 2017-04-25 10:47:58 · 343 阅读 · 0 评论 -
leetcode 76. Minimum Window Substring
题目: 难度: hard思路: O(n)复杂度下感觉要用哈希表,使用两个指针,指向进行的首尾,当发现有包含T字符串的序列时,移动首指针,缩小氛围,大体思路是这样,但是具体细节和代码实现写不出来-,-。 再读懂了其他解答的情况下实现了代码AC解:class Solution {public: string minWindow(string s, string t) { //原创 2017-08-01 16:11:29 · 518 阅读 · 1 评论 -
leetcode10. Regular Expression Matching
难度:hard题目:AC解:class Solution {public: bool isMatch(string s, string p) { int slen = s.length(); int plen = p.length(); if (slen == 0 && plen == 0) return true;原创 2017-09-04 17:36:03 · 348 阅读 · 0 评论 -
leetcode 44. Wildcard Matching
难度:hard题目:与leetcode10. Regular Expression Matching此题类似,同样采用动态规划,这两题解法很精彩,比较经典AC解:class Solution {public: bool isMatch(string s, string p) { int slen = s.length(); int plen = p.leng原创 2017-09-04 17:48:39 · 335 阅读 · 0 评论 -
leetcode115. Distinct Subsequences
难度:hard题目:被hard程度吓到了,首先想到的是用递归求解,写了一个多小时没做出来,其实是一个简单的动态规划AC解:class Solution {public: int numDistinct(string s, string t) { int m = s.length(); int n = t.length(); vector<ve原创 2017-09-04 19:11:30 · 294 阅读 · 0 评论 -
leetcode93. Restore IP Addresses
难度:medium题目:IP 地址是一个32位的整数,每8位的十进制组成一个数,用 . 分隔很明显是一个回朔法的题,特别注意的是遇到0时的情况,还有每个数值要小于256,进行剪枝减小运算量AC解:class Solution {public: vector<string> restoreIpAddresses(string s) { int len = s.length()原创 2017-09-04 19:20:14 · 391 阅读 · 0 评论