Category "arrays"

How to find Z highest subset Sums from the array of N elements

I have an array of numbers, now I want to find all possible subset sums and get the top z elements in it. Example: Input : arr[] = {2, 4, 5}, z = 3 SubsetSums

Remove specific object from array during aggregation

I have documents with the following structure: {field: ["id1", "id3"]}, {field: ["id2", "id1"]} To query the documents I use aggregate({$match: {'field' : { $i

Accessing a JSON array inside of a JSON object in Android Studio

I am testing my knowledge and ability with android studio and API's, I have been using volley and I have come across a little problem. The API I have been using

How can I access and process nested objects, arrays or JSON?

I have a nested data structure containing objects and arrays. How can I extract the information, i.e. access a specific or multiple values (or keys)? For examp

searching in arraylist always not found

no matter what I use indexof() or contains or .equals() changing everything to uppercase or to lowercase It always return false and not found can someone please

convert dictionary to abstract matrix in julia

I'm trying to do dimension reduction, and I got a: d = Dict{Tuple{String, String}, Vector{Float64}} Trying to apply umap on it. While umap can only accepts abs

How to convert an array of numpy.float64 into an array of float64?

I have a np.array containing several other np.arrays, themselves containing objects of type numpy.float64, which cause the following issue with one of my method

How to map more than one property from an array of objects

I have an array of Object as follows: var obj = [ {a: 1, b: 5, c: 9}, {a: 2, b: 6, c: 10}, {a: 3, b: 7, c: 11}, {a: 4, b: 8, c: 12} ]; I know about how

Restructuring the object using different name [Object manipulation]

I have a use case where I have to restructure the object. Initial I have this object { name: 'Tommy Kerar', mandatoryRequirements : [{ name:

Error: {"data": "foreach() argument must be of type array|object, string given", "message": "" in React Native

i have to send this Array object to the API when i post the API data it shows me this error: Error: {"data": "foreach() argument must be of type array|object,

Google foobar challenge (Prepare the bunnies escape)

I recently received an invitation to a google foobar challenge I am currently on level 3. I've written a code which passes 3/5 test cases and I can't seem to fi

filter array of objects by another array of objects

I want to filter array of objects by another array of objects. I have 2 array of objects like this: const array = [ { id: 1, name: 'a1', sub: { id: 6, nam

Transform array of arrays to a single array

I would like to expand a list of arrays into a single array, so for example: a = [array([1,2,3]), array([4,5,6]), array([7,8,9,])] To become: a = [array([1,2,3

handle multiple checkboxes and complex data structure (reactjs)

Since I am pretty new to React and also not a huge expert on JS especially ES6, I wonder how to make my code (that works) prettier and refactor it. I want to h

use ctypes.py_object to implement array class in python

This is first part of code. from ctypes import py_object from typing import TypeVar, Generic T = TypeVar('T') class ArrayR(Generic[T]): def __init__(self

Find Top-K Smallest Values So Far in Data Stream

Let's say that I have a data stream where single data point is retrieved at a time: import numpy as np def next_data_point(): """ Mock a data stream. Da

how many number of Cache misses can occur in given c code

Suppose we have two 2-dimensional arrays m and n, and consider the following C code. int m[4][4]; int n[4][4]; for (int i = 0; i < 4; i++) for (int j

Avoid duplicates in nested loop python

So i have nested loops and array [[0, 1], [0, 1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4]]: for x in string_list: for y in string_list: print(x,y)

May a compiler store function-scoped, non-static, const arrays in constant data and avoid per-call initialization?

In reading How are char arrays / strings stored in binary files (C/C++)?, I was thinking about the various ways in which the raw string involved, "Nancy", would

Is there a way to upload the byte type created with zlib to Google bigquery?

I want to input string data into bigquery by implied by pyhton's zlib library. Here is an example code that uses zlib to generate data: import zlib import p