Category "arrays"

Merge JavaScript objects in array with same key

What is the best way to merge array contents from JavaScript objects sharing a key in common? How can array in the example below be reorganized into output? Her

Merging 4 sorted Arrays into one

I have this method to merge 2 sorted arrays into one sorted array: public void merge(T[] a, int l1, int r1, T[] b, int l2, int r2, T[] c, int l3) {

Inserting array values

How do I write and execute a query which inserts array values using libpqxx? INSERT INTO exampleTable(exampleArray[3]) VALUES('{1, 2, 3}'); This example code

Copying Character array into char array

Hi I want to fast copy array of Characters to array of chars I can write a method that copies Character array into char array, by converting every Charater in a

numpy arange: how to make "precise" array of floats?

In short, the problem I encounter is this: aa = np.arange(-1., 0.001, 0.01) aa[-1] Out[16]: 8.8817841970012523e-16 In reality, this cause a series problem si

Date showing as serial number in formula

I'm currently having an issue with the date format. I have basically extracted the month and year from a standard dd/mm/yyyy date and wish this to be formatted

Javascript twoSum algorithm: Given an array of integers, return indices of the two numbers such that they add up to a specific target

Given an array of integers, return indices of the two numbers such that they add up to a specific target. Example: Given nums = [3, 2, 4], target = 6, Because

Group rows by column and sum another column within groups [duplicate]

I have an array looking like: array(480) { [0]=> array(2) { ["tag_id"]=> string(4) "6291" ["az"]=> int(5) } [

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