Skip to main content

All Questions

2 votes
2 answers
241 views

How to make dynamic variable to check array with .every

For a project we need to check if all numbers in a card, match another card with drawn numbers. When hardcoded with a const checkCard = card001 it goes well with .every. When trying to choose the card ...
Sander Huisman's user avatar
2 votes
0 answers
140 views

Getting an error "Abort Called" while solving a maximum subarray problem

So the problem is given an array we have to find the maximum possible sum among: all nonempty subarrays. all nonempty subsequences. Example: arr = [-1,2,3,-4,5,10] The maximum subarray sum is ...
Hannan Khan's user avatar
1 vote
3 answers
2k views

Finding total number of subsequences in an array with consecutive difference = k

In the given array, I am trying to find the total number of subsequences such that: the difference between the consecutive terms is not greater than 3 the first element of the subsequence is the ...
Amanda's user avatar
  • 2,163
0 votes
2 answers
685 views

Find Maximum Path thats divisible by 3 in 2D array

Given a two-dimensional array of numbers. Find the "snake path" whereas: In a snake path there needs to be a element in each row, and in two adjacent rows the elements are in adjacent ...
Micael Illos's user avatar
6 votes
2 answers
11k views

Difference between Array.push() and Spread syntax

Algo Problem Statement: Find the smallest array that adds up to the target sum. Code Issue: I do not understand the difference in results when: using the arr.push() method vs. using the Spread ...
Pmcorrea's user avatar
1 vote
1 answer
342 views

How find the indices of numbers picked for the maximum sum of non adjacent numbers in an array

I have come up with the algorithm for finding the maximum sum of non adjacent elements in an array, but I have some trouble finding which numbers are picked for the summation. Here is my algorithm for ...
Andyzz's user avatar
  • 11
1 vote
2 answers
73 views

Dynamic Programming: return all match data

I have written a simple dynamic program which can return first matched data. Now I want to get all matched data. My data : let countryList = { country: [{ name: "Bangladesh", ...
sabbir's user avatar
  • 2,025
0 votes
1 answer
50 views

Extract Array values into object dynamically

I want to create an algorithm that replicates values for this object schema (sample data here): let layer1 = {name: 'x', values: [{_color: '#996666', time: 0, tween: 'quadEaseIn', value: 0},...
Michael Gaio's user avatar