
动态规划
文章平均质量分 72
ZWB626
这个作者很懒,什么都没留下…
展开
-
爬台阶问题(每一次爬一阶台阶,或者每一次爬二阶台阶)
package leetcode;/*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?*///为了节省程序的时间...原创 2018-12-04 22:34:20 · 3328 阅读 · 0 评论 -
triangle
package leetcode;/*Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2],...原创 2018-12-05 15:42:49 · 231 阅读 · 0 评论 -
m*n矩阵从左上角到右下角的路径最小和
package leetcode;/*Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move eith...原创 2018-12-05 16:56:18 · 2550 阅读 · 0 评论 -
数字字符串对应解码方式
package leetcode;/*A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, d...原创 2018-12-09 20:58:48 · 2744 阅读 · 0 评论 -
从方格左上角到右下角的走法
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 bo...原创 2018-12-09 22:27:35 · 2088 阅读 · 0 评论 -
从左上角走到右下角的走法数量(中间有障碍)
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as1and0respectively in the grid.For...原创 2018-12-10 13:02:22 · 2417 阅读 · 0 评论 -
求对应n字节的格雷码数组
题目描述 The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the seque...原创 2019-02-18 22:18:02 · 251 阅读 · 0 评论