![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Algorithm
文章平均质量分 75
icomputational
这个作者很懒,什么都没留下…
展开
-
Sort List
Problem : Sort a linked list in O(n log n) time using constant space complexity.两个解法,一个是递归的,一个是迭代的;不过递归终归还是使用了log n的栈空间,是否满足题意要看怎么认定题目要求了。 有任何其他好的解法,或者对本文解法有任何看法,都非常欢迎讨论,谢谢。1. /** * Defi原创 2014-02-23 21:57:00 · 352 阅读 · 0 评论 -
Convert Sorted List to Binary Search Tree
leetcode, 递归, Convert Sorted List to Binary Search Tree 的两种解法原创 2014-03-19 23:29:53 · 563 阅读 · 0 评论 -
Decode Ways
leetcode,Decode Ways, 动态规划原创 2014-03-31 23:26:34 · 494 阅读 · 0 评论 -
Jump Game
leetcode, Jump Game , 递推求解原创 2014-05-01 23:21:32 · 483 阅读 · 0 评论 -
Subsets II
leetcode, Subsets II原创 2014-05-01 21:41:48 · 482 阅读 · 0 评论 -
Binary Tree Maximum Path Sum
leetcode, 二叉树, Binary Tree Maximum Path Sum原创 2014-04-01 23:26:48 · 830 阅读 · 0 评论 -
Binary Tree Preorder Traversal
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive solution is tr原创 2014-03-21 22:45:47 · 327 阅读 · 0 评论 -
Word Search
Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically n原创 2014-05-04 23:32:22 · 359 阅读 · 0 评论 -
Wildcard Matching
leetcode,动态规划,字符串匹配原创 2014-04-02 23:47:46 · 550 阅读 · 0 评论 -
Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr原创 2014-04-03 22:57:49 · 605 阅读 · 0 评论 -
Permutation Sequence
leetcode , Permutation Sequence, 递推原创 2014-04-05 00:19:41 · 645 阅读 · 0 评论 -
Combinations
combination 的6种解法原创 2014-05-08 00:40:30 · 712 阅读 · 0 评论 -
Gray Code
Gray code 生成的两种解法, leetcode原创 2014-04-08 23:56:34 · 505 阅读 · 0 评论 -
Regular Expression Matching
leetcode, Regular Expression Matching原创 2014-04-27 20:58:47 · 539 阅读 · 0 评论 -
Letter Combinations of a Phone Number
Letter Combinations of a Phone Number, leetcode原创 2014-04-27 17:35:31 · 803 阅读 · 0 评论 -
First Missing Positive
leetcode First Missing Positive原创 2014-06-07 21:49:16 · 564 阅读 · 0 评论 -
Sort Colors
leetcode,三色排序原创 2014-04-29 23:35:55 · 690 阅读 · 0 评论 -
Insertion Sort List
leetcode, insort sort list 的两种解法原创 2014-03-30 16:08:43 · 497 阅读 · 0 评论 -
Maximal Rectangle
leetcode, Maximal Rectangle, 直方图面积计算的O(N)算法,垂线法原创 2014-03-30 19:28:23 · 582 阅读 · 0 评论 -
Median of Two Sorted Arrays
leetcode, Median of two Sorted Array, MIT algorithm原创 2014-03-11 00:41:57 · 641 阅读 · 0 评论 -
Swap Nodes in Pairs
leetcode,链表操作原创 2014-03-05 23:13:24 · 583 阅读 · 0 评论 -
Palindrome Partitioning
leetcode, Palindrome Partitioning , 动态规划 + DFS原创 2014-03-10 23:46:49 · 611 阅读 · 0 评论 -
Distinct Subsequences
leetcode , 动态规划, Distinct Subsequences原创 2014-03-05 00:36:28 · 774 阅读 · 0 评论 -
Linked List Cycle II
leetcode, 链表操作原创 2014-03-05 23:53:22 · 623 阅读 · 0 评论 -
Word Break II
leetcode, DP programmiong + DFS原创 2014-02-28 19:33:48 · 353 阅读 · 0 评论 -
Partition List
leetcode,链表操作原创 2014-03-07 21:36:08 · 442 阅读 · 0 评论 -
Validate Binary Search Tree
binary search tree validation (二叉搜索树验证) 的两种方法和四种实现方式原创 2014-03-11 22:01:18 · 356 阅读 · 0 评论 -
Subset
取当前集合的所有子集合,三种不同思路解法原创 2014-03-15 21:41:47 · 661 阅读 · 0 评论 -
Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", wh原创 2014-03-28 00:06:10 · 593 阅读 · 0 评论 -
KMP算法小节
KMP算法通过预处理待搜索的已知字符串来得到一组其本身组成信息的数据,并用该数据在匹配搜索中对如何进行匹配、移动进行指导。直观来看,设待搜索串为L{i,...,j},长度为M;同时设进行搜索的主串为H{k,。。。,p},长度为N。我们订好串之间的长度限制我们都是满足的。在H中进行匹配搜索的时候,不失一般性,设匹配到任意一点m(0=为了加快速度,我们希望能后通过一些已有的信息来原创 2009-07-23 15:59:00 · 906 阅读 · 2 评论 -
Edit Distance
leetcode, Edit distance, 最优的O(N)额外空间实现原创 2014-03-28 22:32:00 · 455 阅读 · 0 评论 -
Binary Tree Preorder Traversal
leetcode, Binary Tree Preorder Traversal , 两种非递归解法, Morris 遍历讲解原创 2014-03-29 23:25:29 · 550 阅读 · 0 评论 -
Flatten Binary Tree to Linked List
leetcode, 递归,二叉树, Flatten Binary Tree to Linked List原创 2014-03-29 00:21:16 · 654 阅读 · 0 评论 -
Pascal's Triangle II
Pascal's Triangle II, leetcode,两个解法原创 2014-06-06 23:37:03 · 593 阅读 · 0 评论