2022 Developer Survey is open! Take survey.

# Questions tagged [array]

A competition to solve a particular problem through the usage and manipulation of arrays.

730 questions
Filter by
Sorted by
Tagged with
1k views

### Alternating sums of multidimensional arrays

Given a multidimensional array, find the recursive alternating sum. An alternating sum is simply the sum of an array, where every other item (starting with the second) is negated. For example, the ...
239 views

### Write a (simplified) BitCycle interpreter

Implement a function or program that can run simplified BitCycle code. The functions you must implement are: <^>v: Change the direction of a bit to the ...
• 1,260
312 views

### center a matrix [closed]

The words "center a" probably give flashbacks to any decent HTML developer. Luckily, we are not working with divs, we are working with matrices. Given a matrix where w=h, and given a "...
• 691
1k views

### Euler characteristic of a binary matrix

A binary matrix represents a shape in the plane. 1 means a unit square at that position. 0 means nothing. The background is <...
• 32.8k
434 views

### Unshuffle my poker chips

This part is somewhat detached from the actual array manipulation side of the challenge, scroll down for an explanation that is much more array-based You've been learning how to shuffle poker chips ...
1k views

### Is Wally there?

Inpired by recent Stand-up Maths' video. Task Wrapping a list x can be seen as inserting "line-breaks" into x every <...
• 10.9k
1k views

### Get the trends of an array

For our purposes, a trend is a contiguous subsequence of an array that falls into one of three categories: increasing, e.g. [1,2,3,10,239] decreasing, e.g. ...
• 8,758
941 views

• 84.9k
437 views

### Sort musical pitches

Given an unordered list of musical pitches, write the shortest program/function (scored in bytes) to sort the list from lowest pitch to highest. Pitches will be given in scientific pitch notation, ...
• 10.3k
2k views

### Repeat List Until Longer

The Challenge The challenge is simple: given an input list a and another list b, repeat a ...
• 2,497
320 views

### The Nineteenth Bakery [duplicate]

Yes, this is very similar to this question. However, that concerns infinite linked lists, and you do not need to handle out of bounds indexes in that question. You are in a strange city, looking for ...
• 2,497
338 views

### What was my Wordle play?

Task Given a winning Wordle play results (clues), the target ("secret") word and a list of words, output a possible sequence of words leading to such results. The words in the list will be ...
• 10.9k
2k views

### Fill in the next numbers

Given a list of integers, output a list where the $i$th element of the list equals the first number in the input list which is $\ge i$, until there are no such numbers. For example, if the ...
• 18.4k
989 views

### Lexicographically Smallest Decreasing Integer Partition

For a given number n, output an strictly decreasing array whose sum is n and its lexicographical order is the smallest for any ...
• 3,031
558 views

### Crate art stacking

Your task is, given a array of numbers, that is strictly increasing, output the crate stack. The input is an array of positive integers which represents which layer has how many crates there are. So ...
• 3,031
2k views

### Is it a tower permutation?

A tower is made out of layers, each one being one unit shorter than the one below it. Every layer is completely on top of the previous layer. For example, here is a tower along with it's height map: <...
• 6,645
1k views

### Wiggle the tower

Your input is the height map of a tower. The tower is made out of layers, each one being one unit shorter than the one below it. Every layer is completely on top of the previous layer. For example <...
• 6,645
1k views

### Pretty print my arrays

I like to pretty print multidimensional arrays, like this: [ [ [1, 2, 3], [4, 5, 6] ], [ [7, 8, 9], [6, 4, 2] ] ] But it's a pain to do by hand and it'd ...
• 27.3k
949 views

### Smallest maximal rectangle in a skyline

A skyline is an array of positive integers where each integer represents how tall a building is. For example, if we had the array [1,3,4,2,5,3,3] this would be the ...
• 6,645
3k views

### "Defuse" the bombs

You've been hired by a bomb defusing company to perform some "controlled" demolition of un-exploded ordnance. You are given a list of bombs represented by non-negative integers. ...
• 84.9k
888 views

### Simulating Bombs

More advanced version of this The aim of this puzzle is to simulate the impact of the shock wave of bombs on a square grid. The grid initially contains cells labelled ...
• 3,031
194 views

### Heart Point Generator

It's mentioned last time that, in Hearts, Each round every player gets a non-negative amount of points. The sum of the points is 26, and at least one player gets 13 or more points. Actually, it's ...
• 12.7k
3k views

### Largest rectangle in a skyline

A skyline is an array of positive integers where each integer represents how tall a building is. For example, if we had the array [1,3,4,2,5,3,3] this would be the ...
• 6,645
872 views

### Generate all groupings

Let's define a grouping as a flat list, which is either: just 0 2 groupings followed by the literal integer 2 3 groupings ...
• 18.4k
2k views

### Rolling a ball over a list

Starting with a binary list (just 1s and 0s) we are going to roll a ball over it. The ball has a position and a direction. At ...
• 84.9k
449 views

### Can I wall glitch to there?

Background In a 2d game that I play, each screen is a 2d grid of tiles with walls and walkable tiles, with the player only able to travel on walkable tiles, and being stopped by walls. When the player ...
• 3,890
196 views

### Cubax Folding Game

Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move ...
• 3,031
876 views

### Retaining Water

Your task is to check the volume of water in a pool. Your have to create a program that takes in a input that is represented by an 10 by 10 grid of integers, with ...
• 3,031
755 views

### Check if a matrix is Zarankiewicz-maximal

My final-year project at the National University of Singapore is on Zarankiewicz's problem: What is the maximum number of 1s in an $m×n$ binary matrix ($m$ rows and $n$ columns) with no $a×b$ ...
• 753
206 views

### Bracket Depth List

Challenge Your challenge is simple, calculate the depth of each matching brackets in the given input e.g. (()()(()))->...
• 3,031
1k views

• 431
448 views

### Count the ways to transform

A rigid transformation of a square array is a mapping from square arrays of a certain size to square arrays of the same size, which rearranges the elements of the array such that the distance to each ...
• 84.9k
4k views

### Squishy vectors

If we have a list of integers we can "squish" one of them by: decrementing it replacing adjacent values with its new value For example in this list: ...
• 84.9k
1k views

### Sort every dimension

Given a multidimensional, rectangular array of nonnegative integers, sort it at every depth (lexicographically), starting from the innermost. For example, with this array: ...
• 27.3k