# Questions tagged [dynamic-programming]

Questions about problems that can be solved by combining recursively obtained solutions of subproblems.

713 questions
Filter by
Sorted by
Tagged with
10 views

### What is the best algorithm to find the optimal path in reducing company's real-estate footprint?

I was hoping someone could point me in the right direction in terms of what type of problem I am describing and what type of algorithm I should use to answer it. Here is the problem: A company is in ...
29 views

### Relationship between dynamic programming and reinforcement learning

I wasn't sure whether to post this here or in the ai stack exchange - please let me know if i need to move my post elsewhere) I have been learning about how dynamic programming can be used as a tool ...
21 views

### Find exact sum in path

So the question is 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. You can only move down and to ...
37 views

### Two-Sum Algorithm Design - Pre-sort, Range Allowance, Many Sums

🧩 Design Questions I would love feedback on the pseudocode design outlined in the section below and if each design is an optimal approach in terms of runtime complexity? Pre-Sort: Is it possible to ...
41 views

### Minimum sum of squared Euclidean distance between two arrays

Question: Given two sorted sequences in increasing order, $X$ and $Y$. $Y$ is of size $k$ and $X$ is of size $m$. I would like to find a subset of $X$, $i.e$, $X'$ of size $k$, and considering the ...
89 views

### Fastest Algorithm for Computing Expected Value [closed]

I came across this interesting problem: If 𝑎 is a finite binary string consisting of just 1's and 0's, then denote 𝑓(𝑎) as the sum of the squares of the lengths of the consecutive runs of 𝑎. For ...
18 views

### C programming pointer topic [closed]

Write a program to find the sum of all non-prime numbers from m and n (including m and n also) using the concept of passing pointers to function. Pass addresses of m, n and sum integers from the main (...
51 views

### approaching dynamic programing for problem

I want to find a solution to a problem that asked before. in the following question: https://stackoverflow.com/questions/43435799/path-with-the-minimum-number-of-alterations-in-graph-with-colored-...
60 views

887 views

### How to calculate the minimum price required to buy all the stones?

I have shared the question above. My current algorithm does the calculation in O((n^4)*(2^n)). Can someone please help me out to solve this faster?
44 views

### Get the maximum sum of n items below a threshold

Consider a modified Knapsack Problem where: The number of items to be included is fixed. The value of each item is equal to its weight. Therefore, given a set of numbers, a threshold and the number ...
89 views

### How do I calculate the time complexity of this memoized algorithm?

The problem is: count all increasing subsequence of s. ...