Category "arrays"

Find lowest value matched from an Index/Match of an array

Example Spreadsheet Current formula not returning values as desired: =IFERROR(ifNA(min(arrayformula(index(D2:I2, match(INDEX(FLATTEN(split(A2, ", ", FALSE)&

Odd number Sequence Replaced by Count

I am working on java Program here is program Question: Consider Java Program. It reads integers from the standard input (until it gets a negative number) and

Convert a Text File into an Array, without the '/n'

I am trying to code a sorting code, very basic, using the python "(sorted)" method. For this code, I am trying to import the words to be sorted by using a text

Convert text to associative array in bash script [closed]

Hi I am new to bash scripting. I have a text as shown below input = {'A': '1' 'B': '2' 'C': 'Associative_Array'} I want to convert the above t

Shuffle nested arrays in Javascript

I'm trying to sort multiple arrays within an array (which also has to be shuffled). A simplified example is: let toShuffle = [ [1, 2, 3, 4, 5], [9, 8, 7, 6, 5],

Find the max value of the same length nails after hammered

I'm trying to solve this problem: Given an array of positive integers, and an integer Y, you are allowed to replace at most Y array-elements with lesser val

Sort an array except one element in JavaScript

I have an array and I am sorting it but I need to sort everything except one element of my array. My array is: var Comparison = [ {key: "None", value: "No

Trying to find "magic combinations" in MongoDB

I have two MongoDB collections in a database named "records". Here's a sample document from the first collection: course_completions { "_id" : NumberInt(1

How to take 2D array inputs from command Line arguments in java?

I have to take inputs from the command line and assign them to a 2X2 array. Input = 1 2 3 4 (from cmd line) output = 1 2 3 4 int a[][] = new int[

debug an array of linked lists in c

I'm having a trouble in my project, at first I made one linked list and it worked properly but then I had to edit it and make it an array of linked list, but it

Array.prototype.filter() expects a value to be returned at the end of function array-callback-return

I am trying handle below code and its showing enter image description here const toArray = props => (props && props.split ? props.split(',') :

Codewars Challenge - JavaScript - Find the first non-consecutive number in Array

Link to Codewars challenge This is very basic, but for some reason, I can't figure out why I'm not able to return null when there are not any non-consecutive n

Is there a way to convert an Object[] array to char[] array?

class Solution { char[] make(String s){ Stack<Character> st= new Stack<Character>(); for(char c:s.toCharArray()){ if

C# - Random Generator exclude last number from Array

I've just started my first little project in C# and with WinForms and I am stuck on this one feature for a few days now.. I have an Array with about 60 PictureB

How can I create a 2D array of chars with POINTERS in C?

I'm trying to create a program which the user inputs the number of items (rows) and give each one of them a name (scanf) with the max of 30 characters. I want t

Show total number of selected filters array of items in React

I have the following problem. In widgetFilters array (length===3) i want to show the numbers of selected items in the header of the Filter. const [selectedFil

Output how many duplicates in an array

I'm looking to output the number of duplicates for each int in an array e.g. the array 1,2,3,4,1,1,3 would output 1:3, 2:1, 3:2, 4:1. at the moment no matter ho

Inserting a new element to array

So my goal is to join two Arrays together and insert the new size of the new array in the beginning of the array.

Filtering array with Boolean giving unexpected results

I can't understand why the output is 17 its only returning the true values not the false values either that the false value are boolean also function countSheep

How can I use optional chaining with arrays and functions?

I'm trying to use optional chaining with an array instead of an object but not sure how to do that: Here's what I'm trying to do myArray.filter(x => x.testKe