Category "arrays"

Structure formData in an array

I have an extensive form and I'm trying to organize this so that it remains practicable for the plan that I intend to have with it. An example showing what my f

Find sorting algorithm for an elevators floor travel schedule, starting from the current floor with preselected floors to reach and a travel direction

I'm making an elevator in react, But I need to make a function that sorts an array to the nearest to the number X and also there is a condition if the elevator

How do I bold the first Item in my array only, while leaving the rest normal?

so I want to bold the first Item in my array of this typewriter effect. you can see below the type of effect I'm going for. Judaism is <strong> A Religion

Java getJSONArray when it is set to null

The problem happens when I'm trying to get children of a comment. If the child key is null, my application crashes and gives me this error: org.json.JSONExcept

Using VLOOKUP with two lookup values while using IMPORTRANGE to merge three Google Sheets

I have created three google sheets wherein one google sheet is designed as the Masterfile for the data present on the two other google sheets. I was able to mer

How to replace min and max value row in 2-d array python

i have an 2-d array(matrix) 3x3 like [[1, 2, 3],[4, 5, 6],[7, 8, 9]] and i need to replace 2 rows where is max and min value so its looks like: [[7, 8, 9],[4, 5

Faced an error: excess elements in char array initializer during print out of array of strings

I've tryed to print out some array of strings but faced error: excess elements in char array initializer Please make a hint what's worng with this code? Step 1

Jest: test that an array contains none of these values?

I want to verify that a given array doesn't contain any of a list of values. There is expect.arrayContaining but I don't get how it is supposed to be used for t

Binary search program cause runtime error and failed hidden test cases

I am practicing binary search with problem 704 on leetcode. At first, I just follow the concept of binary search and came up with this solution: int search(int*

How to sort array of objects by dates and make new arrays which will contain all objects with same date [closed]

I have a very specific problem in Javascript. I have array of objects, and each object contains some date. const array = [ {name: 'first', dat

How can update values in an array of objects?

how to get new array newSelect using map ,forEach const selects = [false, true, true, true, false]; const oldSelects = [ { select: true, name: 'AA' },

TypeError: state.find is not a function

I try to use the find() method but I get cartItems.find is not a function what happens? and how to fix it? import React, {useState} from 'react' function car

How to sort array in constant time in java and python?

I was trying to learn algos and data structures, and i was wondering about best approach to sort arrays in constant time. I am newbie but my only intention is t

Implode columnar values between two arrays into a flat array of concatenated strings

I have two arrays, $array_A and $array_B. I'd like to append the first value from $array_B to the end of the first value of $array_A and repeat this approach fo

Delete an item(Object) from an array using ng-if

I am trying to remove item using ng-if and ng-else-if. "ng-if="navItem.gbn.indexOf('12345') !== -1" is true then array item only show contains('12345') items. b

Group data in a multidimensional array based on two columns

I have an indexed array of associative arrays like this: [ ['brand' => 'ABC', 'model' => 'xyz', 'size' => 13], ['brand' => 'QWE', 'model' =&

Most efficient way of showing or calling repeat/duplicate HTML?

I have five div elements containing the same six images. Only one div is shown at a time (others are display:none) but all are on the same page. Basic example:

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