原创 LintCode-劍指Offer-(41)最大子數組

class Solution { public: /** * @param nums: A list of integers * @return: A integer indicate the sum of

原创 LintCode-劍指Offer-(380)兩個鏈表的交叉

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNo

原创 LintCode-劍指Offer-(105)複製帶隨機指針的鏈表

class Solution { public: /** * @param head: The head of linked list with a random pointer. * @return:

原创 LintCode-劍指Offer-(97)二叉樹的最大深度

/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; *

原创 LintCode-劍指Offer-(82)落單的數

class Solution { public: /** * @param A: Array of integers. * return: The single number. */

原创 LintCode-劍指Offer-(68)二叉樹的後序遍歷

/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; *

原创 LintCode-劍指Offer-(69)二叉樹的層次遍歷

class Solution { /** * @param root: The root of binary tree. * @return: Level order a list of lists of

原创 LintCode-劍指Offer-(70)二叉樹的層次遍歷Ⅱ

class Solution { /** * @param root: The root of binary tree. * @return: Level order a list of lists

原创 LintCode-劍指Offer-(165)合併兩個排序鏈表

class Solution { public: /** * @param ListNode l1 is the head of the linked list * @param ListNode l2 i

原创 LintCode-劍指Offer-(12)帶最小值操作的棧

class MinStack { public: MinStack() { // do initialization if necessary } stack<int> s; sta

原创 LintCode-劍指Offer-(174)刪除鏈表中倒數第n個節點

/** * Definition of ListNode * class ListNode { * public: * int val; * ListNode *next; * ListNode

原创 LintCode-劍指Offer-(245)子樹

class Solution { public: /** * @param T1, T2: The roots of binary tree. * @return: True if T2 is a subt

原创 LintCode-劍指Offer-(376)二叉樹路徑求和

/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; *

原创 LintCode-劍指Offer-(46)主元素

class Solution { public: /** * @param nums: A list of integers * @return: The majority number */

原创 LintCode-劍指Offer-(73)前序遍歷和中序遍歷樹構造二叉樹

class Solution { /**' * ' *@param preorder : A list of integers that preorder traversal of a tree *