All Questions
Tagged with dynamic-programming dynamic
70
questions
0
votes
0
answers
30
views
Grid traveller: Find maximum score while satisfying a constraint using dynamic programming
Assume we have a 9 x 9 grid with integer values at each cell. A traveler begins at any column of his preference in the first row. Each turn, he goes either down, down-left, or down-right. This is, if (...
0
votes
0
answers
57
views
I am working in Iterable and am looking to link a different url based on the users state
Based on the usera profile and events pulled into Iterable I want to send them a link to a page with information based on their state.
User: John Smith
State: AL
They would recieve in their email an ...
0
votes
3
answers
2k
views
Finding minimum number of steps to reach (x,y) from (1,1) : we can increment number by using condition (x,y+x)or(x+y,x)
a = 1
b = 1
x=int(input())
y=int(input())
def minsteps(x,y):
if x==a and y==b:
print(1)
return 1
if x<a and y<b:
print(2)
return 20
count = 1 + ...
1
vote
2
answers
2k
views
Convert semicolon-separated string into table structure?
I need some help for converting a string into in ITAB.
LOOP AT LT_0111_FILE INTO LV_STRING.
SPLIT LV_STRING AT ';' INTO TABLE LT_0111.
DO GV_COMP TIMES.
READ TABLE LT_0111 ASSIGNING &...
1
vote
1
answer
661
views
String condition to bool
I am busy trying to create an if statement on the front end from the back end string value
The image above is from the back end and I replaced the $blody1$ with
so in the end it will be something ...
0
votes
2
answers
300
views
What is wrong with my code? Nth Fibonacci Number
public:
long long int lookup[100]={-1};
long long int nthFibonacci(long long int n){
// code here
if(lookup[n]==-1){
if(n<=1) lookup[n]=n;
...
0
votes
1
answer
64
views
Confused about two types of sub problems in dynamic programming
At first i apologize for my bad english.
Recently i am facing some confusing thing about two types of dynamic programming.
In "longest common subsequence" problem if the char is not equal ...
0
votes
0
answers
44
views
minimum subset which forms a given number from array dynamic programming python [duplicate]
LOOKING FOR DP RECURSIVE WAY TY
task question: given a target number and an array of positive integers, print the minimum subset which sum of its element give you back target number
i.e. f(7, [1, 2, ...
2
votes
2
answers
86
views
number of path grid problem Python, Memory Error and Recursion Error:
so i tried to solve a simple grid problem and i solve like this :\
def grid_count (n,m):
if m == 1 and n == 1:
return 1
if m == 0 or n == 0:
return 0
return grid_count(m-1,...
-1
votes
1
answer
746
views
optimised pascals triangle with dynamic programming using python
def pascal(row, col):
if col == 1 or col == row:
return 1
else:
return pascal(row - 1, col) + pascal(row - 1, col - 1)
The above recursive implementation is exponential in ...
0
votes
1
answer
131
views
Finding the longest consecutive sequence of integers that appears in both integers
I am given two integers X and Y. The goal is to find the longest consecutive sequence of integers that appears in both X and Y. So, if X = 124534891 and Y = 324534768, then the output would be ...
0
votes
1
answer
195
views
dynamic programming, tsp problem, 9 cities out of 15
I think I have some kind of TSP problem. I have matrix of distances between 15 cities:
A B C D E F G H I J K L M N O
A 0 3 8 7 8 9 4 4 2 9 5 5 7 9 9
B 9 0 6 3 8 9 3 9 5 3 3 4 8 6 8
C 1 7 0 8 3 5 4 3 ...
0
votes
1
answer
101
views
in subset sum problem , when i am taking memo[sum][size] i have to add sum<0 but not in case of mem[size][sum] .i do not why . please explain
#include<bits/stdc++.h>
using namespace std;
int issubseset(vector<int> subset,int size,int sum,vector<vector<int>>&memo){
// if(sum<0)return 0;
if(sum==0) ...
0
votes
2
answers
449
views
Finding k-coloring (with k = 2/3) graph in linear time
Question:
Given a graph G = (V,E) a k-coloring of G is a labeling of the vertices with the colors c_1, c_2, ..., c_k such that for every edge (u,v) the color of u is different from the color of v.
A. ...
0
votes
1
answer
281
views
How to fire a dynamics c# plugin on specific field value
How can I enable a dynamics c# plugin when a specific value is chosen from an options set?
For example: I have an option set that contains the values red, blue, and green. I want the plugin to start ...