摘要: 引用可以简化原来使用指针的代码,至少看起来舒服点,不过今天发现个问题,先来看一段代码#include #include #include using namespace std;int main() { vector stack; stack.push_back(1); int& rx = stack[0]; int vx = stack[0]; int vy = rx; cout >::operator[] (0FC1276h) 00FC649F mov dword ptr [rx],eax i... 阅读全文
posted @ 2014-03-21 22:04 卖程序的小歪 阅读(246) 评论(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 preorderTraversal(TreeNode *root) { vector res; if (root == NULL) return ... 阅读全文
posted @ 2014-03-21 14:28 卖程序的小歪 阅读(134) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: vector inorderTraversal(TreeNode *root) { vector res; if (root == NULL) return res; vector > stack; ... 阅读全文
posted @ 2014-03-21 12:53 卖程序的小歪 阅读(218) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: vector twoSum(vector &numbers, int target) { vector ret; vector > nums; for (int i=0; i target) { ... 阅读全文
posted @ 2014-03-21 02:41 卖程序的小歪 阅读(202) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: int minimumTotal(vector > &triangle) { if (!triangle.size() || !triangle[0].size()) return 0; int row... 阅读全文
posted @ 2014-03-21 02:06 卖程序的小歪 阅读(126) 评论(0) 推荐(0) 编辑