摘要:
1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 class Solution { 9 public: 10 double findMedianSortedArra... 阅读全文
摘要:
class Solution {private: int shd_cnt[256]; int cur_cnt[256];public: string minWindow(string S, string T) { int slen = S.length(); ... 阅读全文
摘要:
记忆搜索总是一个快速的方法(这里假设测试用例中s1和s2的长度都不超过(2^16) - 1), 当然用记忆搜索的,往往就可以写成DP的形式的,不用担心大数据时栈溢出了#include #include #include #include #include using namespace std;cl... 阅读全文
摘要:
class Solution {#define SINGLE 1#define MULTIP 2public: bool isMatch(const char *s, const char *p) { if (s == NULL || p == NULL) return true... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 10 using namespace std; 11 12 typedef pa... 阅读全文
摘要:
室友在做于是也做一发,跟已知两种遍历序列还原二叉树的思路类似,感觉PAT上的题目跟书本知识靠的近一些#include #include #include using namespace std;void print_data(const vector &as, const vector &ns) {... 阅读全文
摘要:
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文
摘要:
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ... 阅读全文