# Questions tagged [array]

An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array, or vector) or multiple indexes.

98 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
824 views

### Intersection of two lists in Python

I am currently working on an algorithm, which involves finding the intersection of two lists. That is, given the following inputs [1,2,2,1],...
415 views

### Implementing recursive filters with Haskell/Repa

I recently learned Haskell, and I am trying to apply it to the code I use in order to get a feeling for the language. I really like the Repa library since I manipulate a lot of multi-dimensional data....
87 views

### c# Efficient solution: Sequence generator for a pattern

This is an interview question to generate the below pattern of numbers in a sequence, which is: 12.34, 23.45, 45.67, 78.910, 1112.1314, 1617.1819, 2223.2425, 2930.3132, 3738.3940, 4647.4849, 5657.5859,...
275 views

### Summing 2D NumPy array by multiple labels

Each element of the array is a coordinate (x, y). Each coordinate has two labels. Goal: sum the elements that have the same two labels. How can ...
37 views

### Simple Pretty-Bytes Size (SI System)

This is a simple and short "Pretty Bytes" javascript function using the SI Decimal System for quantifying bytes. The code does not use complex maths such as ...
207 views

### Finding where column slices of elements in multi-dimensional array are equal

Skippable Intro: I have a dataset that corresponds to an observed time-series. The dataset is organized into a dictionary - which contains an array of years, an array of months, an array of days, an ...
56 views

### Split an even length array in two such that each sub-arrays sum is as close as possible

I am currently iteratively forcing the solution by evaluating all of one elements possible coexisting elements for the closest combination to half of the initial arrays sum. Note: The initial array is ...
62 views

### Find the max value between minimum values in sub-arrays

I have an array of integers, I have to find all sub-arrays of different size from 1 to len(array). In every sub-array, I have to ...
38 views

### Generate big an array from a few words

I need to generate a huge array from a few words, and not random, I must get the same array always for the same words. I wrote this code which will generate 3050 from 51 letters, but I'm sure there ...
23 views

### Speeding up a complex array function in excel

I have a complex array function that takes way too much time to calculate, which is why I'm looking for ways to make it more efficient. Basically, I have a transaction sheet in which I list all goods ...
1k views

### Alternative for VLOOKUP/Index-Match in VBA

I am sharing this function I wrote with the community to provide an alternative to slow VLOOKUP and/or Index-...
170 views

### A fixed-size dynamic array

Background I implemented the historic std::dynarray according to the specification under the name dynamic_array in C++17. ...
2k views

### Deepest pit of an array

Following is based on a problem description from a Codility test, as a task in an interview. DeepestPit - problem description A non-empty zero-indexed array B ...
69 views

### I/O-TxtFile Line Distance Program

I am trying to write a lab/program that loops through a .txt input file. Reads an entire line of data as a string, then splits that string into an array delimited by a space. If there are 4 items in ...
404 views

### Longest Substring Without Repeating Characters in Scala

Question is taken from Leetcode and solution works for their test cases. I do see a scope of improvement and make it more functional (getting rid of vars and mutables data structures). Please suggest ...
233 views

### Getting all unique permutations from a slice of integers slices in golang,

For a project I'm working on I have a set of number sets, and I need all unique permutations of them. I want to return only one copy of each unique number set, and I'm struggling to figure out how ...
102 views

### Cryptocurrency forecasting app

I wrote a cryptocurrency (or any other) market forecasting application in Python 3.5. The code is getting bigger and more complex so I would love if some experts would take a look at it and check and ...
111 views

### Substitute for std::array::operator[] in C++11 by using template-based recursion

What follows is a simplified version of a tentative implementation for a template-based set, named TemplateArgs. For the sake of clarity and focus on the question ...
51 views

### Scrolling 2D Tiles

update: So, this is weird, I just reinstalled Adobe Animate, and now, when I do ctrl+enter (test movie), it pulls up an AIR window, and plays my app, and it works smooth as butter! (now I'm just not ...
38 views

### Create archive webpage for newsletters based on nested array

I am creating a webpage for my newsletter archives. The archives are divided by year (currently there is only 1, but there could be many), then by topic, before listing each newsletter. There will ...
91 views

### Implementing a templated Array class

I have implemented an Array class using templates. I have used a std::allocator object for memory allocation. Will it be better to use operator new along with placement new for memory allocation? ...
1k views

### Add values to a multidimensional array of unknown depth

I have the following class: ...
168 views

### any that can hold arrays

I've tried to make a better any than before: ...
84 views

### Create array given number of larger elements to right of each member

I want to improve on my original solution to this problem, my solution is O(n^2) and I think it's possible to solve in less time You have two arrays: A and B. A contains ints and B has pairs: (...
45 views

352 views

### Drawing an ASCII grid in Ruby based on a 2D array

I'm writing a function that renders a grid using ASCII line-drawing characters, based on a provided 2D array (or array of arrays), with each top-level array representing a row, and the items inside ...
89 views

### Kaitai Struct: shift rotate >1 byte groups

This is an implementation of rotation (cyclic shift) of many-byte groups to the left. Rotate right is supported as negative amount. I would like to request, if someone would be willing, to review this ...
38 views

### Multilang sentence to N-gram

Task: Transform sentence to n-gram and remove all punctuation Tests: Input: ngram('Name, + other ~ name!', 1) Result: ['Name', 'other', 'name'] Input: ngram('Name, + other ~ name!', 2) ...
59 views

### intersection of two arrays

I have written a logic to find out the intersection of two arrays. Please review my logic and guide me if my logical approach is not correct. ...
99 views

### With 2 sets of strings, find a string that can be constructed from either set

Given the following sets of strings: are yo you u how nhoware alan arala dear de I need to find a sequence that can be constructed by concatenating the strings ...
142 views

### Spellchecker program is having issues due to vowel checking method

This program takes in a list of 275k or so words from '/usr/share/dict/words' and loads them into HashSet. It then takes in a list of 1000 words (taken from the dictionary and are scrambled (vowel ...
983 views

### Converting [UInt32] -> [UInt8] -> [[UInt8]]

I am trying to speed up my current implementation of a function that converts [UInt32] to a [UInt8] which in turn is split up ...
111 views

### One-based array in JavaScript

One day I stumbled upon a question on Stack Overflow: How do I create an array in javascript whose index starts from 1. The top answer says that it's impossible. However, that answer was posted ...
288 views

### Beginner grid-based game movement engine (PART 2)

I've tried to make the code overall more PEP-8 friendly and added more comments to make it more readable. Added some new functions and methods like ranged attack and allegiance. Play around with it. ...