Category "arrays"

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

Transform array, set each array element with parent key php

I am receiving data that is an array of elements that contains an array of tags by language like this [ { "1": "tag_es1;tag_es2;tag_es3", "2": "tag_e

Find lowest value matched from an Index/Match of an array

Example Spreadsheet Current formula not returning values as desired: =IFERROR(ifNA(min(arrayformula(index(D2:I2, match(INDEX(FLATTEN(split(A2, ", ", FALSE)&

Odd number Sequence Replaced by Count

I am working on java Program here is program Question: Consider Java Program. It reads integers from the standard input (until it gets a negative number) and

Convert a Text File into an Array, without the '/n'

I am trying to code a sorting code, very basic, using the python "(sorted)" method. For this code, I am trying to import the words to be sorted by using a text

Convert text to associative array in bash script [closed]

Hi I am new to bash scripting. I have a text as shown below input = {'A': '1' 'B': '2' 'C': 'Associative_Array'} I want to convert the above t

Shuffle nested arrays in Javascript

I'm trying to sort multiple arrays within an array (which also has to be shuffled). A simplified example is: let toShuffle = [ [1, 2, 3, 4, 5], [9, 8, 7, 6, 5],

Find the max value of the same length nails after hammered

I'm trying to solve this problem: Given an array of positive integers, and an integer Y, you are allowed to replace at most Y array-elements with lesser val

Sort an array except one element in JavaScript

I have an array and I am sorting it but I need to sort everything except one element of my array. My array is: var Comparison = [ {key: "None", value: "No

Trying to find "magic combinations" in MongoDB

I have two MongoDB collections in a database named "records". Here's a sample document from the first collection: course_completions { "_id" : NumberInt(1