摘要:
https://oj.leetcode.com/problems/word-ladder-ii/啊,终于过了class Solution {public: vector > findLadders(string start, string end, unordered_set &dict) {...
阅读全文
posted @ 2014-08-19 10:32
qingcheng奕
阅读(162)
推荐(0)
编辑
摘要:
https://oj.leetcode.com/problems/valid-number/判断给的串,是不是合理的 数字形式主要问题在需求定义上吧class Solution {public: bool isNumber(const char *s) { if(s == NUL...
阅读全文
posted @ 2014-08-17 20:29
qingcheng奕
阅读(137)
推荐(0)
编辑
摘要:
https://oj.leetcode.com/problems/wildcard-matching/模拟通配符的匹配做法非常好 class Solution {public: bool isMatch(const char *s, const char *p) { bool h...
阅读全文
posted @ 2014-08-17 17:25
qingcheng奕
阅读(125)
推荐(0)
编辑
摘要:
https://oj.leetcode.com/problems/string-to-integer-atoi/细节题,把一个字符串转换成整数class Solution {public: int atoi(const char *str) { if(str == NULL) ...
阅读全文
posted @ 2014-08-17 14:49
qingcheng奕
阅读(122)
推荐(0)
编辑
摘要:
https://oj.leetcode.com/problems/minimum-window-substring/模拟题这道题细节比较多。从左到右扫一遍模拟着做 class Solution {public: string minWindow(string S, string T) { ...
阅读全文
posted @ 2014-08-17 11:37
qingcheng奕
阅读(158)
推荐(0)
编辑
摘要:
https://oj.leetcode.com/problems/clone-graph/图的拷贝,就是给一个图,再弄出一个一模一样的来。/** * Definition for undirected graph. * struct UndirectedGraphNode { * int l...
阅读全文
posted @ 2014-08-16 22:22
qingcheng奕
阅读(133)
推荐(0)
编辑
摘要:
https://oj.leetcode.com/problems/remove-element/简单处理class Solution {public: int removeElement(int A[], int n, int elem) { if(n == 0) ...
阅读全文
posted @ 2014-08-16 21:04
qingcheng奕
阅读(110)
推荐(0)
编辑
摘要:
https://oj.leetcode.com/problems/swap-nodes-in-pairs/链表的处理/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *...
阅读全文
posted @ 2014-08-16 20:57
qingcheng奕
阅读(119)
推荐(0)
编辑
摘要:
https://oj.leetcode.com/problems/scramble-string/一个字符串的混排变换,简直太妙了,好题class Solution {public: bool isScramble(string s1, string s2) { if(s1.si...
阅读全文
posted @ 2014-08-16 16:47
qingcheng奕
阅读(125)
推荐(0)
编辑
摘要:
链表排序,要求使用 O(nlgn) 时间,常量空间。使用归并的思路/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int ...
阅读全文
posted @ 2014-08-16 14:48
qingcheng奕
阅读(112)
推荐(0)
编辑