04 2015 档案

摘要: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 p 阅读全文
posted @ 2015-04-27 19:41 Mr.do 阅读(118) 评论(0) 推荐(0) 编辑
摘要: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 al 阅读全文
posted @ 2015-04-26 13:42 Mr.do 阅读(120) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2015-04-23 15:42 Mr.do 阅读(100) 评论(0) 推荐(0) 编辑
摘要: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 cl 阅读全文
posted @ 2015-04-22 12:55 Mr.do 阅读(144) 评论(0) 推荐(0) 编辑
摘要:转载出处:http://hawstein.com/posts/dp-novice-to-advanced.html 简介(入门) 什么是动态规划,我们要如何描述它? 动态规划算法通常基于一个递推公式及一个或多个初始状态。 当前子问题的解将由上一次子问题的解推出。使用动态规划来解题只需要多项式时间复杂 阅读全文
posted @ 2015-04-22 10:30 Mr.do 阅读(135) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2015-04-20 15:44 Mr.do 阅读(103) 评论(0) 推荐(0) 编辑
摘要: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, 阅读全文
posted @ 2015-04-13 14:04 Mr.do 阅读(114) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示