# Minimum Path Sum @ LeetCode (Python)

**kitt**posted @ 2014年3月13日 01:30 in LeetCode , 2109 阅读

动态规划, 这道题和Unique Paths II如出一辙。

class Solution: # @param grid, a list of lists of integers # @return an integer def minPathSum(self, grid): rows = len(grid) cols = len(grid[0]) # initialization dp = [[0 for j in xrange(cols)] for i in xrange(rows)] dp[0][0] = grid[0][0] for i in xrange(1, cols): dp[0][i] = dp[0][i - 1] + grid[0][i] for i in xrange(1, rows): dp[i][0] = dp[i - 1][0] + grid[i][0] # dynamic programming for i in xrange(1, rows): for j in xrange(1, cols): dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]) + grid[i][j] return dp[rows - 1][cols - 1]

2022年9月17日 12:51

Department of Education and Secondary Education Board has designed the AP SSC Civics Model Paper 2023 Pdf with answers for Telugu Medium, English Medium & Urdu Medium Students of the State Board. Every year there are a huge number of teaching staff and educational portals of the state have suggested the practice question bank with revision questions for both medium students of the board. AP 10th Civics Question Paper In civics, students learn to contribute to public processes and discussions of real issues. Students can also learn civic practices such as voting, volunteering, jury service, and joining with others to improve society. Civics enables students not only to study how others participate but also to practice participating and taking informed action themselves.