Below you will find pages that utilize the taxonomy term “DYNAMICPROGRAMMING”
Posts
Climbing Stairs
PROBLEM You are climbing a staircase. It takes n steps to reach the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
Example1 *Input*: n = 2 *Output*: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps Example2 *Input*: n = 3 *Output*: 3 Explanation: There are three ways to climb to the top.
read morePosts
Dynamic Programming
It’s an advanced Algorithm In computer science, dynamic programming is an algorithmic method for solving optimization problems. The concept was introduced in the early 1950s by Richard Bellman. At the time, the term « programming » means planning and scheduling
The most used techniques for dynamic programming are:
read morePosts
Minimum Path Sum
PROBLEM 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 either down or right at any point in time.
Example *Input*: grid = [[1,3,1],[1,5,1],[4,2,1]] *Output*: 7 Explanation: Because the path 1 → 3 → 1 → 1 → 1 minimizes the sum. Constraints m==grid.length n==grid[i].length 1<=m, n<=200 0<=grid[i][j]<=100 SOLUTION We’ll use Dynamic Programming method.
read more