Category "arrays"

Remove pair duplicates from array of values

The problem In lua I have an array of values (specifically - x and y position values) from which I would like to remove duplicate pairs. The array looks as fol

In a CUDA kernel, how do I store an array in "local thread memory"?

I'm trying to develop a small program with CUDA, but since it was SLOW I made some tests and googled a bit. I found out that while single variables are by defau

javascript - match string against the array of regular expressions

Is there a way in JavaScript to get Boolean value for a match of the string against the array of regular expressions? The example would be (where the 'if' stat

Why is this PHP array not the same?

I'm not understanding why the array: <? $data = array( 'items[0][type]' => 'screenprint'); ?> Is not the same as <? echo $data['items'][0]['typ

ElasticSearch aggregation query that concatenate array of strings into one bucket if attribute has value

The aim is to create an aggregation query in ElasticSearch that concatenate array of strings into one bucket if the attribute has a certain value. An example J

Remove objects with a duplicate property from List

I have a List of objects in C#. All of the objects contain a property ID. There are several objects that have the same ID property. How can I trim the List

Daily Coding Problem 260 : Reconstruct a jumbled array - Intuition?

I'm going through the question below. The sequence [0, 1, ..., N] has been jumbled, and the only clue you have for its order is an array representing whether e

Is it possible to define function that creates an N-dimensional list of lists easily?

I have searched and found these questions: How to create a multi-dimensional list and N dimensional array in python which hint toward what I am looking for, but

How to determine if one array contains all elements of another array in Swift?

I have 2 arrays: var list:Array<Int> = [1,2,3,4,5] var findList:Array<Int> = [1,3,5] I want to determine if list Array contains all findList elem

Given sorted Array, Returns index i if array A contains an element A[i] such that A[i] = i (recursive and divide and conquer)

So i have homework to make a recursive method that uses a divide and conquer algorithm to search a sorted array and check if A[i] == i (if value matches current

JS group by month of date values (objects) in an array

My array is like this: myArray = [ {date: "2017-01-01", num: "2"} {date: "2017-01-02", num: "3"} {date: "2017-02-04", num: "6"} {date: "2017-02-05", nu

Upsample and Interpolate a NumPy Array

I have an array, something like: array = np.arange(0,4,1).reshape(2,2) > [[0 1 2 3]] I want to both upsample this array as well as interpolate the re

Trying to understand Abstract class inheritance and subclass object comparison

I'm working on a project for my data structures class and I've been having a hard time wrapping my head around Abstract class inheritance and how it can be mani

List all contiguous sub-arrays

I have an array [1, 2, 3] of integer and I need to return all the possible combination of contiguous sub-arrays of this array. [[1],[2],[3],[1,2],[2,3],[1,2,3]

Return complete array from Promise

I have a function that returns JSON objects using hnews.getById(id). I then push each story returned in the promise to an array. I'm having trouble figuring out

Using "in" to check whether a string occurs in an array [duplicate]

In Javascript is it possible to check whether a string occurs in an array by using the "in" operator? For eg: var moveAnims = new Arra

Dynamically initialize array size in go

I try to write a small application in go that takes 'x' numbers of integers from standard input, calculates the mean and gives it back. I have only gotten so fa

Rotation of the array means that each element is shifted right by one index, and the last element of the array is also moved to the first place

For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7]. The goal is to rotate array A K times; that is, each element of A will be shifted to

Rotation of the array means that each element is shifted right by one index, and the last element of the array is also moved to the first place

For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7]. The goal is to rotate array A K times; that is, each element of A will be shifted to

Check If array is null or not in php

I have an array like below which is generated by parsing a xml url. The array is Array ( [Tags] => SimpleXMLElement Object ( [0] =>