Questions tagged [array]
A competition to solve a particular problem through the usage and manipulation of arrays.
823 questions
4
votes
0
answers
176
views
Find the factor to use for shortest simple Brainfuck data initialization loop
I like writing answers using Brainfuck, since this language basically simulates a Turing machine, and it is pretty challenging to find the shortest answer for any problem, since there are a lot of ...
11
votes
9
answers
852
views
All possible swaps for the permutation
Given a permutation of {1,2,...,n} named A, do each swap of form swap A[i], A[j] exactly once, where ...
12
votes
8
answers
726
views
Output the symmetric inverse semigroup
The symmetric inverse semigroup is a very important object in the study of semigroups, for a number of reasons, but most obviously due to the Wagner-Preston theorem. In brief, for any set \$X\$, the ...
7
votes
4
answers
1k
views
Tips for golfing in array languages
We already have a few language-specific tips threads for languages which fall under the array-language umbrella, but there are many golfing tricks which are more or less universal among these ...
15
votes
14
answers
2k
views
Max Island Area
You are given a two-dimensional array consisting of 0s and 1s. The number of rows and columns can vary. For example, 10 by 20.
0 represents water.
1 represents land.
Your task is to find the area of ...
11
votes
13
answers
1k
views
Determine the area of biggest rectangle containing exactly one "X"
Your input is a rectangular 2D char array, such as:
.X.......X
..........
.....X....
..X.......
........X.
.X........
..X.....X.
X.........
....X.....
Your goal is ...
12
votes
13
answers
1k
views
Longest bitonic subarray
Solve this problem in the fewest number of bytes of code possible.
We have a data variable that contains user input data.
Data is a list of integers.
Write the code that finds the longest bitonic ...
12
votes
22
answers
1k
views
Find all unique quintuplets in an array that sum to a given target
Inspiration: Leetcode's [3Sum] link
Problem
Given an array nums of n (not necessarily distinct) integers, and given a target ...
34
votes
15
answers
2k
views
In what order will the downloads complete?
Background
Recently, I was installing updates on my pc with Pacman (I use arch btw) and noticed the order it downloaded files was like this
Start with the largest 4 downloads
When a download ...
19
votes
17
answers
2k
views
Building Skyscrapers
You work as an architect, and you've been assigned the task of reviewing your coworker's skyscraper design. In your line of work, a skyscraper is just a tower of blocks. Nothing more, nothing less.
...
8
votes
47
answers
2k
views
Calculate sum of self-exponentation
Given an array of positive integers, calculate the sum of each number raised to its own power. For example, given 4,6,7, the code needs to return \$4^4+6^6+7^7=...
14
votes
5
answers
451
views
Generate a subgroup of a free group
In group theory, the free group with \$n\$ generators can be obtained by taking \$n\$ distinct symbols (let's call them \$a, b, c ...\$ etc), along with their inverses \$ a^{-1},b^{-1},c^{-1} ...\$ . ...
26
votes
15
answers
2k
views
Is it a cartesian product?
The cartesian product of two multisets \$A\$ and \$B\$ is the multiset of all ordered pairs consisting of an element of \$A\$ and an element of \$B\$. For example, the cartesian product of \$\{1, 2, 7,...
28
votes
23
answers
2k
views
Weave two lists, cycling if necessary
Consider two lists, A and B. To weave them together, we take the first element of A, then the first element of B, then the next element of A, the next element of B, and so on, ending with the last ...
24
votes
19
answers
2k
views
Emulate Jelly's tie-scan
The golfing language Jelly has a built-in ƭ called "tie", that cycles through a list of functions every time it's called. For example, ...