
LintCode算法
一个人的旅行qiu
我原因用我10年的生命换一个闪耀的人生
展开
-
LintCode:单例204
//单例设计模式class Solution {public: /** * @return: The same instance of this class every time */ static Solution* getInstance() { // write your code here if(pInstance ==原创 2017-08-29 17:57:31 · 598 阅读 · 0 评论 -
LintCode:二叉树的最大节点632
原题地址:http://www.lintcode.com/zh-cn/problem/binary-tree-maximum-node/#class Solution {public: /** * @param root the root of binary tree * @return the max node */ Solution(){原创 2017-08-29 14:56:38 · 418 阅读 · 0 评论 -
LintCode:删除链表中的元素452
原地址:http://www.lintcode.com/zh-cn/problem/remove-linked-list-elements//** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(原创 2017-08-29 14:53:08 · 402 阅读 · 0 评论 -
LintCode:二叉树的路径和276
/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; * TreeNode(int val) { * this->val = val; * this->left = this->right =原创 2017-08-30 10:51:00 · 1598 阅读 · 0 评论 -
LintCode:字符串置换211
Hash表思路,时间复杂度为O(n),附加空间复杂度O(n)class Solution {public: /* * @param A: a string * @param B: a string * @return: a boolean */ //思路:将字符串中的每一个值映射到hash表中,统计出现次数,然后比较是否相等 boo原创 2017-08-30 13:49:14 · 711 阅读 · 0 评论 -
LintCode:将二叉树拆成链表453
/** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; * TreeNode(int val) { * this->val = val; * this->left = this->right =原创 2017-08-31 11:37:08 · 431 阅读 · 0 评论