
LeetCode
smllyy
这个作者很懒,什么都没留下…
展开
-
Valid Parentheses
class Solution {public: bool isValid(string s) { int i, head; char stack[100], ch; i = 0; head = 0; while(i ch = s.at(i);原创 2014-11-15 14:55:30 · 525 阅读 · 0 评论 -
Min Stack
算法思想很简单,使用额外的一个栈原创 2014-11-15 15:46:42 · 565 阅读 · 0 评论 -
Reverse Linked List II
逆序链表1.不是整个链表,而是一段链表原创 2014-11-04 16:34:56 · 393 阅读 · 0 评论 -
Copy List with Random Pointer
/** * Definition for singly-linked list with a random pointer. * struct RandomListNode { * int label; * RandomListNode *next, *random; * RandomListNode(int x) : label(x), next(NULL),原创 2014-11-04 10:08:04 · 381 阅读 · 0 评论 -
Insertion Sort List
链表的插入排序1.注意插入的位置原创 2014-11-04 18:45:21 · 382 阅读 · 0 评论 -
Best Time to Buy and Sell Stock II
贪心算法1.寻找递增区间,将所有的递增区间的原创 2014-11-04 22:37:47 · 491 阅读 · 0 评论 -
Swap Nodes in Pairs
交换链表中相邻的两个节点1.注意交换之后,要将jil原创 2014-11-05 10:47:23 · 411 阅读 · 0 评论 -
Sort List
各种排序算法的时间复杂度原创 2014-11-05 11:24:18 · 454 阅读 · 0 评论 -
Construct Binary Tree from Inorder and Postorder Traversal
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti原创 2014-11-24 17:11:45 · 617 阅读 · 0 评论