- 博客(7)
- 收藏
- 关注
原创 LeetCode | Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the
2015-04-27 19:41:00 344
原创 LeetCode | Unique Binary Search Trees II
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 3
2015-04-26 13:42:21 312
原创 LeetCode | Unique Binary Search Trees
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 \
2015-04-23 15:42:01 276
原创 LeetCode | Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?tag: dynamicprogrammingp
2015-04-22 12:55:47 294
转载 动态规划:从新手到专家
转载出处:http://hawstein.com/posts/dp-novice-to-advanced.html简介(入门)什么是动态规划,我们要如何描述它?动态规划算法通常基于一个递推公式及一个或多个初始状态。 当前子问题的解将由上一次子问题的解推出。使用动态规划来解题只需要多项式时间复杂度, 因此它比回溯法、暴力法等要快许多。现在让我们通过一个例子来了
2015-04-22 10:30:44 503 1
原创 LeetCode | Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element
2015-04-20 15:44:06 309
原创 LeetCode | Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1] ha
2015-04-13 14:04:39 324
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人