Category "arrays"

swapping array elements without a temporary variable

The following code: var words = ['javascript', 'hmtl', 'css', 'python']; words[0] = words[3]; words[3] = words[0]; alert(words); ...gives

NumPy Slicing HackerRank

I have wrote a function named array_slice which gets four numbers n, n_dim, n_row, n_col from the user and performs array operations given below. Instructions:

What is the problem in this keras input shape?

from matplotlib import units import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from tensorflow.keras

Need help on Array VBA

I don't understand some parts in the following code: For i = 2 To UBound(a, 1) txt = Join$(Array(a(i, 3), a(i, 4)), Chr(2)) If Not dic.exist

given 2 arrays , create an object, matching the element of array1, with the key of the object of array2

I really don't know where I'm failing, I try 1000 ways, but I can't. function userCheck (arr1,arr2) { let map = {}; arr1.filter((user) => { arr2.f

Array and string in ruby

Hi amazing stackers! date = "10/02/2021" d1 = date.split("/") d2 = d1.to_s puts d1 puts d1.class puts d2 puts d2.class in the above code, d2 shows the data typ

sum up an array in the special style of reduction | (i * 2)

I am currently sitting on a java problem I've found online. We have an array which has several thousand, if not millions, of entries. the goal is to efficiently

I have some instances of a class and I pushed them into an array. Can I loop through the array and update the price of all the array objects?

I have a parent constructor like this: let list = []; class Pictures { constructor(price, title) { this.price = price; this.title = title;

C++: How to remove elements from array at given range without a vector?

I want to delete elements from an array for the given range (indexes) without using vector. For example, if the array is arr[5] = {1, 2, 3, 4, 5} and the lowRa

Fill treeview from custom array of objects. Recursion call

I'm using treeview to display my hierarchical data. I have following array of objects: const data = [ { id: 1, hierarchyid: "/", level: 0, name: "Mhz" },

Mongoose Schema for Groups (a number of users in one group)

One aspect of my website is that people can join groups according to a specific code provided to them, for example- when we play 'Kahoot' or 'Psych', we have to

Difficulties using ArrayFormula

I am trying to use ArrayFormula to populate row data. I have the following formula that work perfect when I drag down, however I am unable to figure out how I s

How can data from a GET request be displayed in HTML?

When I click on my button, I expect the data from the endpoint to be returned. However, I get this error: Id:undefinedURL:undefinedName:undefinedDescription:und

An array of 5 string is given where each string contains 2 characters, Now you have to sort these strings using insertion sort, like in a dictionary

An array of 5 string is given where each string contains 2 characters, Now you have to sort these strings using insertion sort, like in a dictionary. Input Inpu

Concatenation of array and array element on i'th position

Having some declared types and an array: type player = Orange | Red | Blue | White ;; type piece = Knight of player | Town of player | City of player

Return Elements in the array that start with a specific letter e.g D

I am having issue with my code below. I am new to ruby. I want to return names that only start with the letter D but it just returns all the names. When I try t

How to avoid poorly optimized code for Fortran array pointers?

I get rather poorly optimized assembly with gfortran 11.2 when using array pointers, even in seemingly very simple cases. For example, the optimized code (https

Face detection return value without face

I' using haar cascade for face detection faces_haar = face_cascade.detectMultiScale(image, scaleFactor=1.3, minNeighbors=4, minSize=(30, 30), flags=cv2.CASCADE

With arrays, why is it the case that a[5] == 5[a]?

As Joel points out in Stack Overflow podcast #34, in C Programming Language (aka: K & R), there is mention of this property of arrays in C: a[5] == 5[a] Jo

modifying arrays in C

backstory (if interested): Recently, I have learned to write numbers in binary. So, I wanted to see if I could write every single possibility for 32-bits. So, I