摘要:
引用可以简化原来使用指针的代码,至少看起来舒服点,不过今天发现个问题,先来看一段代码#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... 阅读全文
摘要:
/** * 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 ... 阅读全文
摘要:
class Solution {public: vector inorderTraversal(TreeNode *root) { vector res; if (root == NULL) return res; vector > stack; ... 阅读全文
摘要:
class Solution {public: vector twoSum(vector &numbers, int target) { vector ret; vector > nums; for (int i=0; i target) { ... 阅读全文
摘要:
class Solution {public: int minimumTotal(vector > &triangle) { if (!triangle.size() || !triangle[0].size()) return 0; int row... 阅读全文