Category "arrays"

Find the first and last element of a NumPy array larger than a threshold

I need to find the first and the last element of a numpy.ndarray which are above a specified threshold. I found the following solution, which works, but it look

algorithm to merge two arrays into an array of all possible combinations

Example given in JavaScript: Suppose we have two arrays [0,0,0] and [1,1,1]. What's the algorithm to produce all possible ways these two arrays can be combine.

Calculate the sum of values within an array of objects [duplicate]

I am trying to find the total sum for each item sold inside an array, like so: The array looks like this: [ { 'Some Title Item', '22',

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

I'm running a PHP script and continue to receive errors like: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php on line 10 Notice: U

Is there a way to concatenate two arrays in Excel without VBA? [duplicate]

I am trying to create a formula that returns the concatenation of two arrays of different lengths. I need this concatenation for part of anoth

Create li from loop through array and display to HTML as a list

I am learning javaScript and I want to loop array and display to HTML as a list. How can I do that? Array: var array = ['Slide 1', 'Slide 2', 'Slide 3', 'Slid

I want to create a 30x30 matrix array of 1s and 0s

I want to create a 30x30 matrix array of 1s and 0s. This will be a maze with 1's being the path and 0's being a wall. but this labyrinth should contain a way gu

Chunk and transpose a flat array into rows with a specific number of columns

An array of values are provided in the order they should appear in columns. For example, the second value in the array should be displayed on a webpage beneath

Typescript filter array based on value from another array

This question has been asked many times, but I can't get it working. I have two arrays, the first one is: first= [ { id:1, descrizione: "Oggetto

Why does array_map() with null as callback create an "array of arrays"?

Today I learned about a special case of array_map() in PHP, which is mentioned as a side note in the documentation: Example #4 Creating an array of arrays

java program to print array element when index is entered by user

Forgive me if my question is stupid, I am a beginner, I found some Java code in which html components and some data were encoded and stored in array as string..

Javascript/Google Maps API - "TypeError: undefined is not an object (evaluating 'addresses[x][0]')

I am trying to plot markers on a google map using an array of addresses. The markers are correctly plotting (I used the tips in this post: Multiple markers Goog

Make calculations across multiple tables based on the table suffix in Bigquery

I have a database of daily tables (with prefixes formatted as yyyymmdd) with customers info, and I need to get a 90 day timeline of 90 day ARPUs (average revenu

How to update array value in Laravel

My controller code: $userBasicInfoId = $this->userBasicInfo->where('user_id', $userProfile['id'])->value('id'); if($userBasicInfoId) {

Filter array by skipping every nth element from the end

Is there an efficient way to get an array by skipping every n elements starting from the end (so that the last element is always in the result)? Basically, I ha

Trying to solve symmetric difference using Javascript

I am trying to figure out a solution for symmetric difference using javascript that accomplishes the following objectives: accepts an unspecified number of ar

Combine array with same value and add other [duplicate]

I'm trying to find a way to combine array with the same value, and add other values of associative array. I have an array of something like th

Two 2D array's of coordinates, finding if any of the coordinates from the different arrays are within a set distance of one another (python)

I have been trying to figure out how to make it so there is two 2D arrays, each containing a number of arrays that have x and y coordinates for set objects of t

Checking whether space should be printed in the middle or at the end in for loop?

I am trying to give info to my program whether it should print space or not. My code looks something like this, and its printing spaces at the end (which is not

function loop for more than one times java

so basically i tried to call method that return array from other class java, it works perfectly except it double the size or length of the array 2 times from or