Category "arrays"

Logic of for loop using with array to access elements of the array in java

My code to access elements of array using for loop. The output of the program is [19,17,15] which are the elements of array int a[] = { 12, 15, 16, 17, 19, 23 }

extract longest non NaN sequence from array

I want to extract the longest sequence of consecutive non NaN values from an array in Python. So from this one: a = [NaN, NaN, NaN, 1, 4, NaN, NaN, NaN, 4, 6, 8

How can I remove the last comma from a map?

I have, { mydata.map(({ name }) => ( <p style = {{ display: "inline" }} > { " " } { name }, </p>)) } How can I remove the last c

Conways game of Life with 1D array

Right now I'm doing this tutorial for WebAssembly with Rust. The task is to implement Conways Game of Life in Rust. Writing a low-level language like Rust is ne

extract intensity profile along a line from image

ch4-out is the sample imageI have a numpy array that contains some image data (ch4_out). Now, I want to extract intensity profile along a particular line (horiz

How to make a array inside array?

I have this two array. I want to make a array inside an array like this. How can I achieve that. Code posted below. This is the image I am sending inside fileTo

How to convert array of objects into custom grouped array

I am trying to convert the data object to custom format This is my data which i want to convert [ { Name: 15, GroupID: 1, Id: 1 }, { Name: 16, GroupID: 1,

How to vectorize such an algorithm in python?

I have four (nx1) dimensional arrays named a, b, c, and F. I want to run this algorithm without any loops. for i in range(n): if a[i] < b[i]: F[i

how to find possible combinations

I have an array of 16 columns and 22 rows. please advice how to find all possible combinations with the following rules: I can't choose more than 1 value per ro

Is there a more functional way to merge and foreach/sort two arrays in TypeScript, React?

I'm learning React and TypeScript. For sake of practise, I've tried to create a calculator design by merging two arrays to map a single array onto the grid (dis

JavaScript sorting of an RGB array

This is the task: Colors have to be ordered in such way: Higher Red value first; if the same then: Higher Green value first; if the same then: Higher Blue val

How to post an image file with a list of strings using FastAPI?

I have tried a lot of things, but it doesn't seem to work. Here is my code: @app.post("/my-endpoint") async def my_func( languages: List[str] = ["en", "hi"]

How to sort a array with a function and using a code like this in java

Hello i have a java Code where i the Programm should sort the variable num but it only gives out some weird strings. I would like if you could help my with some

How to split input text file that has string and doubles?

I am to read from an .txt input and sort into array by line (read: first name, last name, grade1, grade 2, grade3) but I am having issues. I am assuming that I

How do I take the repeated values in an array and print out the number of duplicates using a for loop ?(Java)

I have written the following program which takes the duplicates in the doubleArray and adds them to a counter. Then I wrote a for loop to print out the values i

Update a dynamic created JS html table after a row is deleted

I have an HTML table dynamically created via JavaScript. After filling in some fields, clicking the "Add" button adds a new row to the table. After inserting a

How to save JSON parsing values to an array in ArduinoJson

Arduino users, help pls! Hi guys! For example, I have a JSON document for parsing ArduinoJson: { "id": [ 1, 7, 32, 9656 ] } I need to save

Change of behavior of a function to compute multiple numpy arrays mean

I have three BGR color values (stored into numpy arrays) and I want to compute their mean value (of each element, as to have a numpy array looking like this : [

How to use Image Literal in the latest Xcode version 13?

I have tried the #imageliteral method but it seems to not working also. I need to use many images in an array so is there any alternative to it or not?

Properly filter names on an array in java

so I have this data on an array and I need to only appear [ {apellido_paterno:"algo",nombre: "jose"} ] in the output but its showing all 3 of the objects let da