Let's say I have 7 small bins, each bin has the following number of marbles in it:  var smallBins = [1, 5, 10, 20, 30, 4, 10];   I assign these small bins to 2 large bins, each with the following maximum capacity:  var largeBins = [40, 50];   I w...
Original question: How do I scale an image in JavaScript without CSS support?  My team has an STB environment, kind of an EPG thing, that supports JavaScript and DOM thrown to it. CSS support exists but we can't inject our own CSS there. The unit...
In JavaScript, is there a more efficient way of calculating perfect squares working from odd numbers than this (the last perfect square stored in the array perfectSqrs is console.logged):  let n = 999,     oddNums = [],     i; for (i = 3; i < n; i...
I am very weak in Math. I am a web programmer, and usually my work does not involve too much math - its more of putting records into database, pulling out reports, making those fancy web pages etc etc. So, I got a task that is "mathy" for me,...
(See example below to fully understand what I'm asking)  I have an array of items that I will put other items into and remove items out of depending on user choices. This array always has an "active set" of contiguous items of no more tha...
I'm confused and I've tried getting the following javascript to render a Total amount calculation but I'm having $NaN and some cell are not displaying the correct values when a dropdown list is used to pick a mailing option.  Here's t...
I'm looking for a solution to the knapsack problem where multiple constraints are in place.  Say our knapsack has a maximum weight of 30kg and we have a set of 100 objects, each with a weight and each with a benefit. These obj...
The function in question is:  var arrayOf150 = [...]; // Array of 150 elements  function foo(array){     for(var i = 0; i < array.length; i++){         for(var j = i+1; j < array.length; j++){             for(var k = j+1; k...
Assume I want to minimize the distance traveled between a series of cities:  starting tour: S-1-2-3-4-5-E  optimal tour: S-5-1-2-3-4-E  The tour must start at S, must end at E, but can visit the cities in between in any order. In my use case, the num...
I'm solving a scheduling problem where I want to assign a number of tasks to the fewest number of employees possible. Each task has a predefined start time, so I start with the earliest tasks of the day, assign them to employees, and update that...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.