arrays Questions

5

Solved

is there a way to dynamically access an array dimension (ideally without reshaping)? I have an n-dimensional array arr as well as a named order of dimensions vals. Both the number of dimensions for...
Arrogance asked 31/10 at 10:15

4

Solved

I am trying to write a function in JavaScript to get the unique values ​​of an array, but my code does not work correctly. I know there are other better and simpler ways to do it, but I don't under...
Purim asked 13/10, 2019 at 2:11

4

Suppose I have a long, unordered, and gradually growing column that I search the even numbers from. =filter(A1:A,ISEVEN(A1:A)=TRUE) Now I would like to reverse this result, so that the last even n...
Gumshoe asked 30/7, 2020 at 18:50

2

Solved

I have array of size (3, 3, 19, 19), which I applied flatten to get array of size 3249. I had to write these values to file along with some other data, so I did following to get the array in strin...
Chinkapin asked 2/7, 2018 at 21:47

4

Solved

For an array: ["5","something","","83","text",""] How to remove all non-numeric and empty values from an array? Desired output: ["5","83"]
Morganite asked 3/6, 2014 at 18:47

1

I have a source file with a large byte array representing an image. Below an example (in reality it can be any random data): const uint8_t image_test_image[] ={ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,...
Spelt asked 26/9 at 14:55

3

How to make an element array inside an array explode again. I have an array like this echo "<pre>"; print_r($pks); The Result. Array ( [0] => 2017-04-15||KMTC_HOCHIMINH [1] => 201...
Helve asked 19/5, 2017 at 2:41

2

Solved

I have a string like this String incoming = "<html> <head></head> <body> <p><span style=\"font-family: Arial;\">Ευχαριστώ (eff-kha-ri-STOE) Tι κανείς (tee-KAH-n...
Cuisse asked 11/12, 2019 at 7:19

4

Solved

I've got an API I'm working with that accepts a call every 5 seconds, any more than that it wont respond. In each call it will accept 5 records in a batch. I've got a list of 1000s of records that ...
Steak asked 2/10, 2014 at 11:22

5

I was reading that JS recently introduced a new array method groupBy to manipulate an array such const products = [ { name: 'apples', category: 'fruits' }, { name: 'oranges', category: 'fruits' }...
Torsion asked 5/8, 2022 at 17:8

1

Solved

Given we can do a left-rotate (and subsequently a right-rotate) of an array only in terms of calls to reverse, like so: void rotl(std::string &s, const int d) { std::reverse(s.begin() , s.begi...
Limekiln asked 18/9 at 8:32

4

Solved

I am having a hard time learning how to loop through a string in Go to do some stuff (specifically, to separate words than contain vowels). I wrote this code snippet: https://play.golang.org/p/zgDt...
Exeunt asked 24/8, 2016 at 9:5

5

Solved

Why doesn't ICloneable's Clone method return a deep copy? Here is some sample code: class A : ICloneable { public int x = 2; public A(int x) { this.x = x; } public A copy() { A a = new ...
Elveraelves asked 12/8, 2010 at 3:52

3

Solved

I have a Dataframe with different columns where one of the columns is an array of structs: +----------+---------+--------------------------------------+ |id |title | values| +----------+---------+-...
Bigamist asked 17/6, 2018 at 22:43

3

Lets say I have 3 Numpy arrays, A1,A2,A3, and 3 floats, c1,c2,c3 and I'd like to evaluate B = A1*c1 + A2*c2+ A3*c3. Will Numpy compute it like the below example? E1 = A1*c1 E2 = A2*c2 E3 = A3*c3...
Untidy asked 30/5, 2010 at 5:33

3

Solved

I see frequent mention that Swift arrays, due to copy-on-write, are not threadsafe, but have found this works, as it updates different and unique elements in an array from different threads simulta...
Composition asked 15/2, 2023 at 12:1

41

Solved

I'm trying to solve Codility lessons for coding practice and PermCheck is one of them. [Edit] Problem Description: A non-empty zero-indexed array A consisting of N integers is given. A permutati...
Dyson asked 15/12, 2014 at 22:19

8

Solved

Let's say, I have an array like this: $array = [ 'car' => [ 'BMW' => 'blue', 'toyota' => 'gray' ], 'animal' => [ 'cat' => 'orange', 'horse' => 'white' ] ]; Then, I wan...
Healy asked 29/6, 2016 at 2:42

12

Solved

Maybe it's stupid question but I cannot realize is that possible to flatten multidimensional array without recursion? I have one solution written by me with recursion: function transform (arr) { ...
Tubule asked 4/12, 2014 at 20:26

2

Solved

I was wondering if there is an easy way in bash to break up a large array into several smaller ones. I currently am thinking something like this: for ((i = 0; i<= (bigArrayLength/2); i++)) do ...
Jobie asked 9/7, 2012 at 17:23

7

Solved

I need to merge JSON objects with same key into one so that it gets an object or array(doesn't matter if result is an object or array) which holds the key and an array for the values example JSON ...
Johnjohna asked 21/12, 2017 at 11:17

6

Solved

#!/usr/bin/perl use strict; use warnings; my @array = qw[a b c]; foreach my($a,$b,$c) (@array) { print "$a , $b , $c\n"; } I receive following error: Missing $ on loop variable What is wr...
Acquit asked 7/6, 2010 at 9:10

6

I am making a bash script and I have encountered a problem. So let's say I got this function create_some_array(){ for i in 0 1 2 3 .. 10 do a[i]=$i done } create_some_array echo ${a[*]} Is ...
Orthicon asked 12/2, 2013 at 18:24

6

Solved

I have a data structure: data = array of integer; I have filled it from an source = array of byte; with data[x] := Source[offset] or (Source[offset + 1] shl 8) or (Source[offset + 2] shl 16...
Mono asked 29/11, 2012 at 20:32

2

I have the following values, each of which is a scalar of type double: a1, a2, a3, a4, a5. I tried to concatenate them using Numpy, as follows: f = np.concatenate((a1,a2,a3,a4,a5)) I however get t...
Diversity asked 27/1, 2018 at 0:15

© 2022 - 2024 — McMap. All rights reserved.