2016年5月8日

机器人的运动范围

摘要: 1 class Solution { 2 private: 3 int add(int n) 4 { 5 int sum =0; 6 while(n != 0) 7 { 8 sum += n%10; 9 n = n/10; 10 } 11 ... 阅读全文

posted @ 2016-05-08 21:15 RenewDo 阅读(122) 评论(0) 推荐(0) 编辑

矩阵中的路径

摘要: 1 class Solution { 2 bool hasStr(char* matrix, int row, int rows, int col, int cols, char* str, vector &all) 3 { 4 if(*str == '\0') 5 return true; 6 if(col... 阅读全文

posted @ 2016-05-08 18:06 RenewDo 阅读(128) 评论(0) 推荐(0) 编辑

滑动窗口的最大值

摘要: 1 class Solution { 2 public: 3 vector maxInWindows(const vector& num, unsigned int size) 4 { 5 vector res; 6 if(num.empty() || size= num[index.back()]) 18 ... 阅读全文

posted @ 2016-05-08 15:57 RenewDo 阅读(116) 评论(0) 推荐(0) 编辑

数据流中的中位数

摘要: 1 class Solution { 2 public: 3 void Insert(int num) 4 { 5 if((count&1) == 0) 6 { 7 if(max.size()>0 &&num ()); 11 num = max.front(); 12 ... 阅读全文

posted @ 2016-05-08 14:43 RenewDo 阅读(113) 评论(0) 推荐(0) 编辑

二叉搜索树的第K个节点

摘要: 1 /* 2 struct TreeNode { 3 int val; 4 struct TreeNode *left; 5 struct TreeNode *right; 6 TreeNode(int x) : 7 val(x), left(NULL), right(NULL) { 8 } 9 }; 10 *... 阅读全文

posted @ 2016-05-08 13:37 RenewDo 阅读(203) 评论(0) 推荐(0) 编辑

导航