摘要: A过了,但是是那种BT解法,明天再想个正解/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: vector<vector<int> > levelOrderBottom(TreeNode *root) { // Start t... 阅读全文
posted @ 2013-04-10 00:18 冰点猎手 阅读(117) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its level order traversal as:[ [3], [9,20], [15,7]] /** * Definition for binary tree * st... 阅读全文
posted @ 2013-04-09 23:55 冰点猎手 阅读(141) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: vector<int> inorderTraversal(TreeNode *root) { // Start typing your C/C++ solution belo... 阅读全文
posted @ 2013-04-09 23:38 冰点猎手 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 不知道是自己运气好还是新的CEGUI 版本比较好编译,我的编译比较顺利,当然其中也遇到一些问题,特此在这里记录,以方便大家学习交流!Build CEGUI 之前,ogre 已装好。 首先说下CEGUI-DEPS-0.7.x-r3-vc10这个文件夹,刚开始我还以为是已经编译好的lib ,差点闹出笑话。自己build的时候才发现是build依赖的文件,在build之前,先把此文件夹中的depence文件夹放到CEGUI-0.7.9文件夹下。 然后剩下的步骤和http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Building+CEGUI... 阅读全文
posted @ 2013-04-09 15:39 冰点猎手 阅读(399) 评论(0) 推荐(0) 编辑
摘要: ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) { // Start typing your C/C++ solution below // DO NOT write int main() function if(l1 == NULL) return l2; if(l2 == NULL) return l1; std::vector<int> a,b,c; while(l1){ a.push_back(l1->val); ... 阅读全文
posted @ 2013-04-09 11:58 冰点猎手 阅读(177) 评论(0) 推荐(0) 编辑
摘要: string addBinary(string a, string b) { const char * charA = a.c_str(); const char * charB = b.c_str(); const char * charC; char *sum = new char[201]; int A = a.size(); int B = b.size(); int C; if(A < B){ C = A; A = B; ... 阅读全文
posted @ 2013-04-08 23:30 冰点猎手 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 vector<vector<int> > fourSum(vector<int> &num, int target) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 vector<vector<int> > output; 7 if(num.size()<4) return output; 8 9 ... 阅读全文
posted @ 2013-04-08 09:32 冰点猎手 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 int climbStairs(int n) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 if(n ==0) return 0; 7 if(n == 1) return 1; 8 if(n == 2) return 2; 9 int a1 = 1;10 int a2 = 2;11 ... 阅读全文
posted @ 2013-04-08 00:21 冰点猎手 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 vector<vector<int> > threeSum(vector<int> &num) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 vector<vector<int> > output; 7 if(num.size()<3) return output; 8 9 sort(num.be... 阅读全文
posted @ 2013-04-08 00:13 冰点猎手 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 int threeSumClosest(vector<int> &num, int target) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() function 6 sort(num.begin(), num.end()); 7 int minSum = num[0] + num[1] + num[2]; 8 int minDiff = a... 阅读全文
posted @ 2013-04-07 23:50 冰点猎手 阅读(134) 评论(0) 推荐(0) 编辑