![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
interesting problem
文章平均质量分 72
HenryZhang
这个作者很懒,什么都没留下…
展开
-
LeetCode: Scramble String, a naive recursion solution
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原创 2013-05-20 14:07:02 · 1136 阅读 · 0 评论 -
LeetCode: Unique Binary Search Trees, Dynamic Programming
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1原创 2013-05-23 12:02:08 · 811 阅读 · 0 评论 -
Set Matrix Zeros
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solution using O(mn) space is probably a b原创 2013-05-09 14:32:51 · 461 阅读 · 0 评论 -
LeetCode: Unique Binary Search Trees II, Dynamic Programming
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1原创 2013-05-23 12:56:13 · 869 阅读 · 0 评论 -
LeetCode: Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", return true.When s3 = "aadbbbaccc",原创 2013-05-29 11:18:43 · 837 阅读 · 0 评论 -
LeetCode: Largest Rectangle in Histogram, a naive solution
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar原创 2013-05-15 14:25:02 · 588 阅读 · 0 评论 -
Word Ladder I
Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediat原创 2013-06-10 06:08:01 · 473 阅读 · 0 评论 -
LeetCode: Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You ma原创 2013-06-06 14:22:01 · 606 阅读 · 0 评论