Category "arrays"

Scratch card game with non-repeat array

This is a scratch card game I modify using script from https://jennamolby.com/interactive-scratch-and-win-landing-page-tutorial/ . I was trying to make a scratc

How do construct id/parentIds with a recursive function

I am trying to build data for a devexpress tree grid using a id/parentId relationship. The id needs to include the complete parent path which will be the parent

How do you print an entire row of a list made of words?

I have simplified my question where I just have a 2x2 list of words. I'm trying to print an entire row but it evidently doesn't work the same as with a list of

Return the sum of the numbers in the array,except ignore sections of numbers

SUMMER OF '69: Return the sum of the numbers in the array, except ignore sections of numbers starting with a 6 and extending to the next 9 (every 6 will

A problem was caused by an array that was not initialized

I am trying to solve a execise, which amis to find the Last Digit of a Large Fibonacci Number, and I try to search for others' solution, and I find one here: h

Merge column values from two arrays to form an indexed array of associative arrays

I have two arrays: $a = ['0' => 1, '1' => 2, '2' => 3] $b = ['0' => 4, '1' => 5, '2' => 6] I want to create a new array like this: [ ['

How to get a specific number of cells using an array formula in Google Sheets

I want to pre-process my data like the Result section of the attached image before flattening and using it. I want to write an array formula in the cells marked

how to calculate Manhattan distance (or L1/ cityblock) for two 2D array?

For 1D vector/array it's easier. For example: array1 = [1, 2, 3] array2 = [1, 1, 1] manhattan distance will be: (0+1+2) which is 3 import numpy as np def city

History referencing in Pine Script arrays

I have been trying to use array feature, which recently has been introduced in PineScript 4, but it seams that either I'm not aware of its limitations, or , pos

How to merge two sorted array?

Question is ==> You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elemen

Minimum moves to transform a list so that each element equals its own frequency

Given a sorted array like [1,2,4,4,4]. Each element in the array should occur exactly same number of times as element. For Example 1 should occur 1 time, 2 shou

Sort array of objects by string property value

I have an array of JavaScript objects: var objs = [ { first_nom: 'Lazslo', last_nom: 'Jamf' }, { first_nom: 'Pig', last_nom: 'Bodine' },

how to implement odd numbers in a new array?

I want to output only the odd numbers from an array with the numbers from 1-100 in a new array. I have no idea how to do this. use strict; use warnings; my @z

Count Occurrences of Seven Integers in Array

I have written the code below and it has comments attached. The application is to read seven integers entered by the user. The application then prints out the n

Check if an array includes an array in javascript

The javascript includes function can be used to find if an element is present in an array. Take the following example: var arr = ['hello', 2, 4, [1, 2]]; c

Downfill incremetation skip 2 columns

I'm trying do create a master sheet for work, as for nom we work in the middle age, copying some data to up to 4 differents documents and I want that to change

accessing nested array key,value from json in javascript

I am new in javascript. It may be a basic thing but I am stuck with it. here is my json: { "statusCode": 200, "status": "success", "data": [

Mongoose - array of enum strings

I have a Schema that has a property with the type of array of strings that are predefined. This is what I've tried to do: interests: { type: [String], e

How to return an array that contains values, which appear in two arrays? And no duplicates

I want to pass two arrays of names so that it will return an array containing the names that appear in either or both arrays. The returned array should have no

Mini-Max Sum In JavaScript - How to Get the Minimum Sum And Maximum Sum of 4 Elements in a 5-Element Array

Link to HackerRank Challenge My idea is to loop through the array and sum all elements in the array except for one element each time, then find the smallest su