摘要: http://oj.leetcode.com/problems/flatten-binary-tree-to-linked-list/分类讨论, 很简单, 注意下给左子树赋NULL值 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x), left(NULL), right(NULL) {} 8 * }; 9 */10 ... 阅读全文
posted @ 2013-11-14 09:45 NextLife 阅读(176) 评论(0) 推荐(0)
摘要: http://oj.leetcode.com/problems/search-insert-position/简单二分. 1 class Solution { 2 public: 3 int searchInsert(int A[], int n, int target) { 4 // IMPORTANT: Please reset any member data you declared, as 5 // the same Solution instance will be reused for each test case. 6 i... 阅读全文
posted @ 2013-11-14 09:42 NextLife 阅读(146) 评论(0) 推荐(0)