Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [dynamic-programming]

Dynamic programming is an algorithmic technique for efficiently solving problems which have recursive structure with many overlapping subproblems. Do NOT use this tag for general "dynamic" behavior in code.

dynamic-programming
1 vote
1 answer
70 views

Rod cutting problem: alternate recurrence in interview

The rod cutting problem is described in section 15.1 of the book "Introduction to algorithms" by Carmen et.al. We are given an array, p where p[j] represents the money we'll get for a rod of ...
Rohit Pandey's user avatar
  • 2,621
3 votes
3 answers
159 views

Longest Repeating Subsequence: Edge Cases

Problem While solving the Longest Repeating Subsequence problem using bottom-up dynamic programming, I started running into an edge case whenever a letter was repeated an odd number of times. The goal ...
William Edwardson's user avatar
0 votes
1 answer
64 views

Finding the most optimal way for updating a dynamic-programming array

Imagine there are n people in a line, which every one of them has there unique value for themselves from 1 to n, we try to sort them like this: repeat swapped = false for i from 1 to n do: ...
FrOZEn_FurY's user avatar
0 votes
1 answer
150 views

how to make column readonly based on the value of another column in oracle apex

I have created editable interactive grid in oracle apex based on employees table. In IG i have mutiple column such as ename,salary and comm. I want to make the comm column readonly based on the value ...
muhammad adil islam's user avatar
0 votes
1 answer
103 views

Best way to crate a simple blog website using using Next.js (MDX or Data fetching)?

I want to create a blog website to write life and code blog, with the rsc and supported meta content like ranking with the google and apple bot with dynamic OG image. next.js is the framework provides ...
Girish Chaudhari's user avatar
0 votes
2 answers
68 views

why ArrayIndexOutOfBoundsException is occurring?

def change(amount: Int, coins: Array[Int]): Int = { val dp = Array[Int](amount + 1) dp(0) = 1 for { coin <- coins i <- coin to amount } dp(...
anil's user avatar
  • 1
2 votes
3 answers
207 views

Maximum Sum Without Skipping Two Contiguous Elements

The task is to find the maximum sum of a subsequence of integers from a given list. The subsequence must follow two conditions: It must be contiguous, meaning the selected elements are in consecutive ...
Vahaid Sk's user avatar
0 votes
2 answers
55 views

dynamic programming: (minimum days of not eating icecreams)

Minimum Days Not Eating Ice-cream Ram decides to eat ice-cream for N days. On each day the ice-cream shop can have chocolate flavour or mango flavour or both or none. The availability of ice-cream ...
Srinivasan A's user avatar
1 vote
1 answer
133 views

Check if a string has a palindrome subsequence of length k

The string S consists of lowercase English letters. I want to know whether this string contains a palindrome subsequence of length exactly k or not. I want a dynamic programming algorithm that runs ...
Sheldoor's user avatar
0 votes
0 answers
72 views

How to efficiently compute similarity scores for prefixes of a string with another string in C?

I'm working on a problem involving string matching where I need to compute the similarity scores for each prefix of a string C against another string S. The similarity score for a prefix P of C and S ...
NatsumiStar's user avatar
0 votes
0 answers
10 views

How do i print only substrings and not subsequences , current solution prints all subsequence as well?

This is a solution for printing the longest Palindormic substring , here it is printing all the subsequence. s = "aacabdkacaa" Use Testcase Output "aacabacaa" class Solution { ...
Mohammed Zishan's user avatar
3 votes
1 answer
67 views

Find nonnegative integer weights of integer inputs array for integer output, minimizing sum of weights

Problem: Given an array of integers inputs and an integer output, return an array of non-negative integers weights such that the sum of the element-wise product of inputs and weights equals output and ...
Gigi Bayte 2's user avatar
0 votes
0 answers
19 views

dynamic programming min path grid sum

"I recently found a frustrating error in my code. I have two solutions for finding the minimum path sum using dynamic programming (DP). The first solution, which I wrote, doesn't seem to work, ...
Suryanarayanan's user avatar
2 votes
1 answer
89 views

How to measure performance metric in a dynamic programming algorithm

I am trying to use the Cell Updates Per Second (CUPS) metric to measure the performance of the sequence alignment algorithm. I saw the metric being used in several papers (ref1, ref2)but none of them ...
engineer1155's user avatar
1 vote
1 answer
235 views

fusing inner lists within list function to return highest possible integer dynamic programming

new to programming and currently trying to challenge myself and learn dynamic programming. I have this question to implement a function that takes an array and outputs the 'highest cuteness' of the ...
romynichols's user avatar

15 30 50 per page