上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 46 下一页
摘要: class Solution {public: void sortColors(int A[], int n) { int cnt[3] = {0}; for (int i = 0; i 0) start += cnt[i-1]; for (... 阅读全文
posted @ 2014-07-17 19:43 卖程序的小歪 阅读(137) 评论(0) 推荐(0) 编辑
摘要: class Solution {private: vector sum; vector step; set can;public: int jump(int A[], int n) { step.clear(), sum.clear(), can.clear()... 阅读全文
posted @ 2014-07-17 16:08 卖程序的小歪 阅读(199) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: bool canJump(int A[], int n) { if (A == NULL || n sum(n, 0); int jump = A[n-1]; for (int i=n-... 阅读全文
posted @ 2014-07-16 16:38 卖程序的小歪 阅读(236) 评论(0) 推荐(0) 编辑
摘要: class Solution {private: int queen_num; vector > res;public: vector > solveNQueens(int n) { res.clear(); queen_num = n; ... 阅读全文
posted @ 2014-07-16 10:13 卖程序的小歪 阅读(154) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: string countAndSay(int n) { vector num; num2digit(1, num); vector tmp; for (int i = 1; i &digit... 阅读全文
posted @ 2014-07-16 09:12 卖程序的小歪 阅读(152) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: TreeNode *buildTree(vector &inorder, vector &postorder) { int ilen = inorder.size(); int plen = postorder.siz... 阅读全文
posted @ 2014-07-15 18:13 卖程序的小歪 阅读(176) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: TreeNode *buildTree(vector &preorder, vector &inorder) { int plen = preorder.size(); int ilen = inorder.size(... 阅读全文
posted @ 2014-07-15 16:25 卖程序的小歪 阅读(137) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *... 阅读全文
posted @ 2014-07-15 10:38 卖程序的小歪 阅读(150) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(... 阅读全文
posted @ 2014-07-15 10:11 卖程序的小歪 阅读(129) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: vector restoreIpAddresses(string s) { vector ips; vector ip; dfs(s, 0, ip, ips); return ips; ... 阅读全文
posted @ 2014-07-05 08:55 卖程序的小歪 阅读(167) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 46 下一页