Category "arrays"

Sum array values

I’m making a shipping service app to Shopify and my callback URL have this JSON post using json_decode to make an array. The value I want to sum is grams

PHP echo values of all sub keys [duplicate]

In the following array: "options": { "front-electric": { "pt": "Vidros Eléctricos dianteir

How to check JSON and add/remove key

I have a JSON file as an export of a nosql database, the sample below is 2 of 1xxx records. { "task": { "id1": { "completed": true,

Find number of int pair in an array that all values between the pair are smaller than or equal to the both

Given an array of integer, find the number of int pair, so that for each pair a_i, a_j, the number between them, i.e. a_(i+1)...a_(j-1) are all smaller than or

Extracting all matrices out of a nested list with varying sublist lengths in R

I have a nested list of matrices. More specifically, I have a list of matrix lists, each with a variable number of matrices. I would like to extract all the mat

building a bottomUp heap

im trying to do a heap bottom up construction from Psuedo code from my text book however the output im getting is not a correct heap im getting out 2 9 8 6 5 7

Value not saving in mongodb

const serverS = await server.findOne({ guildID: message.guild.id }); serverS.settings[1]["links"] = true; serverS.save() The code I use ^^^^ So when it saves t

How to initialize only few elements of an array with some values?

Is it possible to assign some values to an array instead of all? To clarify what I want: If I need an array like {1,0,0,0,2,0,0,0,3,0,0,0} I can create it like:

Yii2 ArrayDataProvider does not show already paginated data

I have an issue with ArrayDataProvider object that Yii2 provides. I have a huge API call that returns more than 7k items (this is a problem because obtaining al

JS Find indices of duplicate values in array if there are more than two duplicates

I'm creating coordinate plane Three in a row game so I have to find out if there are three numbers of the same value in the array BUT WITHOUT sorting array beca

array implementation using python from scratch [closed]

My teacher has asked me to implement an array using python without using any inbuilt functions but I am confused and I don't know how to? this

Replace element at specific position in an array without mutating it

How can the following operation be done without mutating the array: let array = ['item1']; console.log(array); // ['item1'] array[2] = 'item2'; // array is mut

How to convert Java "Arrays.copyOfRange" function to C#?

Working on MergeSort in Java: public void mergeSort(int[] A) { if (A.length > 1) { int q = A.length/2; int[] leftArray = Arrays.

How to convert Java "Arrays.copyOfRange" function to C#?

Working on MergeSort in Java: public void mergeSort(int[] A) { if (A.length > 1) { int q = A.length/2; int[] leftArray = Arrays.

CountNonDivisible - Codility training task

I'm traning on codility now. Some tasks I can solve by myself, but with some tasks have problems. Difficulty of this task is <**>. It's medium, but I stal

Sum in a index/match formula

Could you help me solve the following? I want to return the total sum, not the first match that it finds. My first preference is have indexing and matching wi

Sum in a index/match formula

Could you help me solve the following? I want to return the total sum, not the first match that it finds. My first preference is have indexing and matching wi

Insert multidimensional array to codeigniter cart

I'm building online store using codeigniter and it's cart library. I have this array $data = Array ( Array ( [id] => BM101

Postman - dynamic variable for a value from array

How could I add an automatic environmental variable in Postman based on a value which is appearing in the endpoint response in the array? In the example below,

.filter() does not affect type of array in TypeScript?

check this snippet: interface Foo { id: string; } const fooFunc = (arr: Foo[]): Foo[] => arr .map((item: Foo): Foo | null => { const so