Fork me on GitHub
摘要: 题意大概是给定M×N的棋盘格,从左上到右下,只能向右或者向下走,每走一步需要加上棋盘格子内的数值(有正有负)。 需要随时保证当前的数值>=1。问初始需要最少的值是多少? 思路: 动态规划。用dp[i][j]代表当前最大的数值。首先求出dp[m][n],得出到达右下角的最优值。 然后再回溯求出从左上角 阅读全文
posted @ 2017-08-27 22:27 hellowOOOrld 阅读(722) 评论(1) 推荐(0) 编辑
摘要: If the depth of a tree is smaller than 5, then this tree can be represented by a list of three-digits integers. For each integer in this list: Given a 阅读全文
posted @ 2017-08-27 12:55 hellowOOOrld 阅读(567) 评论(0) 推荐(0) 编辑
摘要: Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decr 阅读全文
posted @ 2017-08-27 11:33 hellowOOOrld 阅读(573) 评论(0) 推荐(0) 编辑