05 2014 档案

摘要:class Solution {public: void merge(int A[], int m, int B[], int n) { int mi = m + n - 1; int ai = m - 1; int bi = n - 1; ... 阅读全文
posted @ 2014-05-29 19:55 卖程序的小歪 阅读(147) 评论(0) 推荐(0) 编辑
摘要:class Solution {private: static int compare(const Interval& a, const Interval& b) { return a.start merge(vector &intervals) { vector... 阅读全文
posted @ 2014-05-29 19:21 卖程序的小歪 阅读(214) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: ListNode *mergeKLists(vector &lists) { ListNode* merged = NULL; for (int i=0; ival val) { n... 阅读全文
posted @ 2014-05-29 18:35 卖程序的小歪 阅读(187) 评论(0) 推荐(0) 编辑
摘要:Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/", =>"/c"click to show corner cas... 阅读全文
posted @ 2014-05-29 16:56 卖程序的小歪 阅读(190) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { ListNode* p = l1; ListNode* q = l2; ListNode* he... 阅读全文
posted @ 2014-05-29 13:52 卖程序的小歪 阅读(175) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: string getPermutation(int n, int k) { k--; if (n nums(n, 0); long seg = 1; for (int i=0; i= se... 阅读全文
posted @ 2014-05-29 09:57 卖程序的小歪 阅读(158) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: int climbStairs(int n) { if (n < 1) return 0; int a = 0; int b = 1; for (int i=0; i<n; i++) { ... 阅读全文
posted @ 2014-05-29 08:42 卖程序的小歪 阅读(131) 评论(0) 推荐(0) 编辑
摘要:参考架构Architecture from OpenStack Install GuideReference Architecture Network Isolation在本次部署中,我们采用了OpenStack中新的网络管理组件(neutron),具体参见安装指导。右图为该网络部署结构的示意,分为... 阅读全文
posted @ 2014-05-28 10:20 卖程序的小歪 阅读(729) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) { ListNode* p = l1; ListNode* q = l2; ListNode* re... 阅读全文
posted @ 2014-05-27 22:13 卖程序的小歪 阅读(197) 评论(0) 推荐(0) 编辑
摘要:const char* lookup[] = {" ", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxy... 阅读全文
posted @ 2014-05-27 20:43 卖程序的小歪 阅读(166) 评论(0) 推荐(0) 编辑
摘要:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文
posted @ 2014-05-27 19:54 卖程序的小歪 阅读(223) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector > permuteUnique(vector &num) { vector > result; if (num.size() path; dfs(n... 阅读全文
posted @ 2014-05-27 19:00 卖程序的小歪 阅读(166) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector > generateMatrix(int n) { vector > matrix; if (n (n, 0)); }... 阅读全文
posted @ 2014-05-27 15:47 卖程序的小歪 阅读(168) 评论(0) 推荐(0) 编辑
摘要:class Solution { public: vector spiralOrder(vector > &matrix) { vector ret; int cols = 0; ... 阅读全文
posted @ 2014-05-27 14:42 卖程序的小歪 阅读(204) 评论(0) 推荐(0) 编辑
摘要:看到构造语意的其中一节“继承体系下的对象构造”(5.2节)的最后,看来原文,发现侯杰的翻译有问题,怪不得读起来不顺。What about when providing an argument for a base class constructor? Is it still physically s... 阅读全文
posted @ 2014-05-24 13:32 卖程序的小歪 阅读(208) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: int maxProfit(vector &prices) { int len = prices.size(); if (len maxv) { maxv = cur; ... 阅读全文
posted @ 2014-05-20 10:46 卖程序的小歪 阅读(177) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: bool isScramble(string s1, string s2) { int len = s1.length(); if (len == 1 && s1[0] == s2[0]) return true; ... 阅读全文
posted @ 2014-05-15 15:32 卖程序的小歪 阅读(167) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: bool search(int A[], int n, int target) { if (n A[mid]) { right = mid; sep = A[mid]; ... 阅读全文
posted @ 2014-05-15 00:24 卖程序的小歪 阅读(160) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: int canCompleteCircuit(vector &gas, vector &cost) { int len = gas.size(); if (len diff(len, 0); for (... 阅读全文
posted @ 2014-05-14 21:22 卖程序的小歪 阅读(251) 评论(0) 推荐(0) 编辑
摘要:class Solution {public: ListNode *insertionSortList(ListNode *head) { if (head == NULL) return NULL; ListNode* sorted_head = head; ... 阅读全文
posted @ 2014-05-10 17:26 卖程序的小歪 阅读(180) 评论(0) 推荐(0) 编辑
摘要:>Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.class Solution {public: int m... 阅读全文
posted @ 2014-05-10 15:20 卖程序的小歪 阅读(211) 评论(0) 推荐(0) 编辑
摘要:好久没写动态规划,中午听到学长们讨论的一道题,就是给出一组硬币面额,和一个目标数值,求有几种找零方式(想半天没想清楚)#include #include using namespace std;int count(int* s, int m, int n) { if (n == 0) retu... 阅读全文
posted @ 2014-05-08 23:48 卖程序的小歪 阅读(226) 评论(0) 推荐(0) 编辑
摘要:class Solution{ public: int maxArea(vector& height) { int len = height.size(), low = 0, high = len -1 ; int maxArea = 0; ... 阅读全文
posted @ 2014-05-08 09:56 卖程序的小歪 阅读(154) 评论(0) 推荐(0) 编辑
摘要:class Solution {private: vector result;public: vector wordBreak(string s, unordered_set &dict) { vector > dp; result.clear(); ... 阅读全文
posted @ 2014-05-07 21:26 卖程序的小歪 阅读(274) 评论(0) 推荐(0) 编辑
摘要:class Solution {private: int* memo;public: bool wordBreak(string s, unordered_set &dict) { memo = new int[s.length() + 1]; for (in... 阅读全文
posted @ 2014-05-06 16:12 卖程序的小歪 阅读(127) 评论(0) 推荐(0) 编辑
摘要:int sunday(string str, string pattern) { int str_len = str.length(); int pat_len = pattern.length(); int char_pos[256]; for (int i = 0... 阅读全文
posted @ 2014-05-06 15:27 卖程序的小歪 阅读(190) 评论(0) 推荐(0) 编辑
摘要:```cppclass Solution {public: void connect(TreeLinkNode *root) { if (root == NULL) return; queue que; que.push(root); i... 阅读全文
posted @ 2014-05-06 09:51 卖程序的小歪 阅读(150) 评论(0) 推荐(0) 编辑