LeetCode
早迎朝阳晚迎星光
这个作者很懒,什么都没留下…
展开
-
Insertion Sort List
题目CODE/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ typede原创 2014-07-16 11:22:47 · 566 阅读 · 0 评论 -
Path Sum
path-sum递归:如果使用递归,需要明确递归的结束条件,结束条件分为几类。递归的模式为:Type f(...) { if 满足结束条件1 return x; if 满足结束条件2 return x; ...... 递归表达式}原创 2014-07-28 11:15:30 · 709 阅读 · 0 评论 -
Single Number II
题目Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it wit原创 2014-07-23 15:31:58 · 648 阅读 · 0 评论 -
Median of Two Sorted Arrays(Need edition)
题目分析方案原创 2014-07-01 10:47:17 · 568 阅读 · 0 评论 -
Single Number
//空间O(n), 时间O(nlogn)class Solution {public: int singleNumber(int A[], int n) { set se; for (int i = 0; i < n; ++i) { auto it = se.find(A[i]); if (it == s原创 2014-07-21 22:18:28 · 642 阅读 · 0 评论 -
Evaluate Reverse Polish Notation
题目Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2原创 2014-07-02 16:47:24 · 450 阅读 · 0 评论 -
模板
题目分析时间复杂度输入ji原创 2014-07-02 16:37:19 · 507 阅读 · 0 评论 -
Reverse Words in a String(Need edition)
题目分析输入shi原创 2014-07-02 08:53:09 · 592 阅读 · 0 评论 -
Linked List Cycle II
题目分析复杂度CODE原创 2014-07-21 13:48:23 · 707 阅读 · 0 评论 -
Two Sum
题目Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the tar原创 2014-07-01 10:35:14 · 630 阅读 · 0 评论 -
Linked List Cycle
题目分析复杂度CODE原创 2014-07-21 11:51:35 · 556 阅读 · 0 评论 -
LRU Cache
题目分析复杂度注意输入原创 2014-07-17 11:13:18 · 689 阅读 · 0 评论 -
Reorder List
题目分析复杂度CODE原创 2014-07-20 22:46:46 · 577 阅读 · 0 评论 -
二叉树非递归遍历--迭代
1、先序2、中序3、后序原创 2014-07-18 16:25:23 · 860 阅读 · 0 评论 -
Binary Tree Postorder Traversal
CODE见 http://blog.csdn.net/staibin/article/details/37932173 中的后序遍历。原创 2014-07-18 21:09:15 · 495 阅读 · 0 评论 -
Binary Tree Preorder Traversal
题目分析复杂度输入CODE/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL)原创 2014-07-17 11:49:29 · 494 阅读 · 0 评论 -
Max Points on a Line
题目分析原创 2014-07-04 14:39:11 · 675 阅读 · 0 评论
分享