Category "arrays"

array.slice strange behaviour with nuxt-edge

EDIT AND SOLVED: I've found the origin of the problem: I thought arr.slice returned the new array but, actually, it returns the deleted element. See the documen

I’m trying to sum the return value of 2 threads together but it return -1 saying error

I’m trying to make a program which sums the numbers in an array, the first half of the array by the first thread and the second half by the second thread

ReactJS - Convert to Array Mapping

How can I convert this link to a array mapping, I already tried making a array object with name, path, icons, and label properties. But when I do that the cart

Using a multiple arrays in order to find the lowest "Ranking" in an character defined ranking system

Wordy title but I was interviewed on this question, couldn't derive the answer and really would love to better understand array usage in excel. Question: You ha

question regarding max value in an array with recursion in JavaScript

Currently, I was able to get the following function to retreive the max value from an array through recursion const max = ([a,...rest]) => !rest.length || a

Code works (mostly). But failure to remove duplicates

Summary: Hey I've got a filter for some data. It's filtering fine but it's not removing duplicate objects. Arguments taken in order: 1. datasource 2. filters (r

Range Error(index): invalid value: valid value range is empty

im trying to set initial value for 'title' but it keeps showing me the error: range error (index): invalid value: valid value range is empty class _ProductCreat

Python - Matching close strings in two separate arrays

I have two different arrays populated with a number of string values and I would like to compare the two arrays and find the matches. The main problem is that t

how to check if the 2d array contain the requirement, and if yes, return the toal score in python

I have a 5 * 5 two-dimensional array, and a dice will be thrown 25 times. For each throw, the user needs to put the value into the two-dimensional array. Becaus

regexp_matches, array per row

In PostgreSQL, I have a table as follow. | id | mycolumn | | -------- | -------------- | | 1 | /1/2/8/ | | 2 | /1/40/22/11/ |

Issue with Generating Random Numbers using Laravel contains vs foreach loop [duplicate]

Hey guys I come across this strange issue where if I use the foreach it does not generate a unique random number wheres if I use laravel funct

Check if two arrays have an object with the same property

Here's my goal: compare two objects and figure out if there is 1 or more items in common. If there are 1 or more in common, return true otherwise (no items in

Python: extracting specific values out an numpy array of indices

I have a numpy array of indices. For example: indices = np.array([0, 1, 2, 6, 7, 9, 12, 13, 14]) I would like to make an array signals = np.zeros(np.amax(indi

Java Array Odd Sorting Algorythm

I got an algorithm to write that set order of an Arrey but in a specific way. Find the lowest number of an array Save it at the start of the new array. Mark in

Declaring a static array of bytes in VBA

I can declare a static byte array in VBA like this, but it appears that the elements are not of type byte. Dim A As Variant A = Array(&H9F, &H2C, &H

How can i make for loop a recursive method

How can I make this code a recursive method? for (int i = 3; i < arr.length; i++) { writer.write(arr[i] + "\n"); strout += arr[i] + "\n"; }

Finding peak in a large data set with python

I want to know if there is a way to eliminate points that are not close to the peak. For example if I have a data set with 10 million points and the peak is aro

Variation: Find the object with the highest value in Javascript [duplicate]

In Finding the max value of an attribute in an array of objects there are many (great) answers that report the highest value in an array, but

constexpr iterate over section in memory

I am trying to turn a function, createArray, into a constexpr function. This function creates an array from a contiguous section in memory marked by two arbitra

Programs which accept uppercase and lowercase commands as input

I'm trying to add a help/information box in my program that pops whenever someone type in a /h, /?, /help commands. I want to make sure that my program accepts