Category "arrays"

PHP Array split string and Integers

Below is an array of strings and numbers. How could the string and number values be split into separate arrays (with strings in one array and numbers in another

I started learning DSA ,while writing code for stack DS in c++ , I came across this error

I started learning DSA ,while writing code for stack DS in c++ , I came across this error. So, while I was trying fixing it , I get to know that when I am using

MATLAB: Subindexing in cell array based on results of strfind

I have a cell array, like so: ID = {'g283', 'sah378', '2938349dgdgf', 'g283'}; I also have some data that corresponds to these IDs. Data = {'data1', 'data2'

Duplicate zero in array by modifying the array in place

There is a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. The elements beyond the length

How to find or count the duplicate in multidimensional array in c# [closed]

I am creating a 2d (3 * 3) array in c# which has to count or find the duplicate value int[,] arr = new int[3, 3] { {1, 2, 6}, {4, 1, 5}

How to use malloc to assign large two-dimensional arrays in C

I know a very large two-dimensional arrays in C needs a long identifier for the variable type when assigning memory to the array to avoid stack overflow errors

How to use malloc to assign large two-dimensional arrays in C

I know a very large two-dimensional arrays in C needs a long identifier for the variable type when assigning memory to the array to avoid stack overflow errors

Declare a 0-Length String Array in VBA - Impossible?

Is it really not possible to declare a 0-length array in VBA? If I try this: Dim lStringArr(-1) As String I get a compile error saying range has no values. I

Largest Triple Products without using sort?

I implemented the Largest Triple Products algorithm, but I use sort which makes my time complexity O(nlogn). Is there a way to implement it without a temporary

Transpose and flatten multiple rows of array data [duplicate]

Is there a native PHP function to zip merge two arrays? Look at the following example: $a = array("a","b","c"); $b = array("d","e","f"); $c

Using reduce() to find min and max values?

I have this code for a class where I'm supposed to use the reduce() method to find the min and max values in an array. However, we are required to use only a si

Understanding the Big O for squaring elements in an array

I was working on a problem where you have to square the numbers in a sorted array on leetcode. Here is the original problem Given an array of integers A sor

Find Nth number of children using JavaScript and want to create Treeview

I have this array of hash and want to recursive this into treeview upto ParentTradeFairResourceId exist. I have tried but not succeeded to create an algorithm.

How do I extract data from a string into a 2d array?

Using axios, I am fetching data from a website. Unfortunately,the data fetch is in HTML format. The data fetched is like this: 1 Agartala VEAT 120830Z 23004KT 5

Matplotlib: display element indices in imshow

From this answer I know how to plot an image showing the array values. But how to show the i,j indices of each element of the array, instead of the values thems

How print a loop inside of sweet alert window

I want to loop an array and show the result using sweet alert, I am new in this so I try the code below, but show me some like [object],[object] swal({ conte

How do fix the "Cannot find 'NSFetchRequest' in scope error

I have tried to make an NSFetchRequest in many different ways and each time I get this error: "Cannot find type 'NSFetchRequest' in scope" Here are the specific

Elegantly calculate the minimum and maximum of a number array simultaneously

In Javascript, given a simple number[] array, is there an elegant way to calculate the minimum and maximum values simultaneously, or return undefined if the arr

array indexOf with objects?

I know we can match array values with indexOf in JavaScript. If it matches it wont return -1. var test = [ 1, 2, 3 ] // Returns 2 test.indexOf(3); Is th

Python: Generating all n-length arrays combinations of values within a range

Ok. I'm looking for the smartest and more compact way to do this function def f(): [[a,b,c] for a in range(6) for b in range(6) for c in range(6)] which