Category "arrays"

How to return an array that contains values, which appear in two arrays? And no duplicates

I want to pass two arrays of names so that it will return an array containing the names that appear in either or both arrays. The returned array should have no

Mini-Max Sum In JavaScript - How to Get the Minimum Sum And Maximum Sum of 4 Elements in a 5-Element Array

Link to HackerRank Challenge My idea is to loop through the array and sum all elements in the array except for one element each time, then find the smallest su

How do I check if an array includes a value in JavaScript?

What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) {

Blockwise reshape in numpy?

I have a numpy array with columns that are in blocks. I want to transpose the blocks. It's conceptually simple, and I guess one can do it simply, but I dont kno

Minimum and maximum sums from a list Python

I've been doing problems on HackerRank to get my foot in the door for solving Python problems and while I've had fun working through a few, one problem is stump

JSON.stringify on Arrays adding numeric keys for each array value

I am trying to convert an array to object . Below is the array value which I am trying to transform into an object. kbInfo : [{ "questionId": "1", "customQuesti

How to fill and access a Django ArrayField?

To solve my (kinda specific) problem, I found that I have to use Django ArrayField: https://docs.djangoproject.com/en/2.1/ref/contrib/postgres/fields/#arrayfiel

Finding performance feasibility using array strings

Here is the requirement details: time = ["09-13", "12-14"] getResult(time) = false The first performance runs from 9 a.m. to 1 p.m. and the second one starts

Movie Recommendation: Generate similar movies for all movies

I'm using scikit-learn TfldfVectorizer to produce the TF-IDF matrix #Import TfIdfVectorizer from scikit-learn from sklearn.feature_extraction.text import TfidfV

Split string of possibly adjacent elements of unknown length by type in JS

Given a string (actually a svg path) such as: "M72 0v754h405v-86h-311v-211h302v-86h-302v-285h311v-86h-405z" I want to obtain an array where each element is eit

How to get multiple values by index in an ojAlgo-array?

Let's say I have an ojAlgo-array defined like this ArrayAnyD<Double> regularArray = ArrayAnyD.PRIMITIVE64.make(10); regularArray.loopAll((final long[] ref

Using array_intersect on a multi-dimensional array

I have two arrays that both look like this: Array ( [0] => Array ( [name] => STRING [value] => STRING )

Finding Arithmetic Mean of Subarrays Efficiently in an Array

I am trying to find number of ways o calculate arithmetic mean of a subarray of an array. It boils down to this; given an array X and an integer S, how many con

Power Automate reminders to be send on number of days from initial day

I am working on SharePoint List solution that acts on date trigger. The base date is a date of parcel receipt. I need a set of reminders that stop once Picked f

Average test score from result array with varying group sizes

I am working on a problem where I have to calculate the average from a bunch of test results with the following criteria. -his program was tested on several tes

Codility CyclicRotation Javascript Solution: Empty array returns an error

I am trying to solve this problem in codility. My solution passed all the tests except for one with empty array and rotation of 1 as arguments. I'm someway lost

Program to find number of elements between two elements a and b (where a and b both are inclusive)

Given an unsorted array of size n, write a program to find number of elements between two user-defined elements a and b (where a and b both are inclusive) of a

How to POST Object Array with Retrofit?

I send the data from the postman like this: {"contacts":[ { "idContact": "201", "name": "Joseph", "lastName": "Herrera",

Can PostgreSQL JOIN on jsonb array objects?

I am considering switching to PostgreSQL, because of the JSON support. However, I am wondering, if the following would be possible with a single query: Let's s

Electronics Shop

I have been working on this question, and after submitting my code 7 cases passed, however, 9 cases failed. The question link is here of HackerRank : Electronic