All Questions
Tagged with dynamic-programming javascript
148 questions
1
vote
1
answer
79
views
The control add-in on control PDFViewer on page PDF Viewer has not been instantiated
I have a problem with the pdf preview control,
when I edit something on a page that does not have the pdf preview, it gives me an error message "The control add-in on control PDFViewer on page ...
3
votes
0
answers
58
views
Why does my recursive memoization function cause a 'Maximum Call Stack Exceeded' error in JavaScript?
While solving fabonocci problem using recursion and memoization in JavaScript, I got "Maximum Call Stack Exceeded" error when I try to run it with large inputs. To troubleshoot, I copied the ...
-1
votes
1
answer
129
views
Coin Change II : To take a value or not to
The problem goes like this:
You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.
Return the number of ...
-2
votes
2
answers
71
views
How to find the optimal products with the lowest price amount with the highest quantity?
I tried to write a function for myself but it somehow incorrectly outputs the final result:
function findOptimalProducts(products, budget) {
const getPrice = (priceString) => parseFloat(...
3
votes
1
answer
81
views
Return correct value at each iteration- dynamic programming
The problem goes like this:
Geek is going for n day training program. He can perform any one of these three activities Running, Fighting, and Learning Practice. Each activity has some point on each ...
1
vote
1
answer
65
views
Coin Change run timeout
I was trying to solve the Coin Change problem. I used two similar pieces of code, but the result is that one passed, while the other run timeout.I want to know why these two similar pieces of code has ...
0
votes
2
answers
101
views
How to dynamically switch between two images onclick in Vue.js
I am trying to switch images on click in Vue.js. My code isn't working but this is what I am trying to make happen:
On load the image is black, after clicked/selected the image switches and turns into ...
0
votes
1
answer
182
views
Split Array problem. Need help in understanding another approach
I was solving this problem:
Given an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized.
Return the minimized largest sum ...
0
votes
0
answers
91
views
Javascript Time limit exceeded
I am trying to solve a dynamic programming problem on LeetCode using an object (obj) as a cache, but I am encountering a 'time limit exceeded' error if I initialize the object like this:
/**
* @param ...
-1
votes
1
answer
142
views
Print the maximum possible quotient of array A
Given an array A of N integers. Your teacher has asked you to find the maximum quotient of the array. Quotient of an array A of size N can be calculated in the following way:
Let the sum of the N ...
0
votes
1
answer
24
views
GridTraveler tabulation error making all elements of the table 0 in js
this is the tabulated version of gridTraveler, where you output the number of ways one can travel from the top left to the bottom right corner in an m*n box, but you can only move down or right.
const ...
0
votes
1
answer
386
views
What are other ways of formatting the SQL in a JavaScript stored procedure in Snowflake?
I created a stored procedure in Snowflake that lets me identify duplicate rows of data in a given table and stop the subsequent code from running.
The parameters for this stored procedure are the ...
0
votes
1
answer
36
views
shares of stack problem with js and dynamic programming
The problem receives an input like [[500, 5, 1], [450, 2, 1], [400, 5, 1]], where each row represents a buyer. Each buyer has a value in position 0, which represents the amount they are willing to pay ...
0
votes
1
answer
270
views
Coin Change Dynamic Programming Problem (limited supply of coins)
I'm trying to solve the coin change problem with the variation that the same coin can be used at most twice.
I solved the problem where the coins are unlimited but I still don't quite understand how ...
2
votes
1
answer
49
views
Filter out arrays of a 2d Array that can be made from other arrays in that 2D array
So, say we have an array of arrays, arr
arr = [[1], [3], [1, 3]]
Now, we want to find a subset of arr that will filter out any arrays whose elements can all be found in other arrays, optimizing for ...