Skip to main content

Questions tagged [array]

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

Filter by
Sorted by
Tagged with
10 votes
11 answers
341 views

Activate the Laser Gates

In a secret lab corridor, there are emitters and gates: A number represents a laser emitter with a certain frequency, a 0 represents an inactive gate. If two ...
turalson's user avatar
  • 371
12 votes
8 answers
2k views

Pennies to Dollars

Over on Puzzling a couple years ago, Hermant Agarwal proposed the following question: In a certain country the following coins are in circulation: 1 cent, 2 cents, 5 cents, 10 cents, 20 cents, 50 ...
caird coinheringaahin g's user avatar
18 votes
5 answers
1k views

Hide from the "left-hand wall" robot

You need to hide in a maze from a robot which methodically follows the left hand wall rule. That is, it enters, immediately turns left, and will always move keeping its left hand on the wall. It only ...
Steve Bennett's user avatar
15 votes
12 answers
712 views

Slender sub-lists

A somewhat interesting task came up for me recently which I thought would make a fun code-golf. Given a number \$n\$ and a list of positive integers less than or equal to \$n\$, we call a sublist ...
Wheat Wizard's user avatar
  • 102k
5 votes
5 answers
340 views

Calculate the Squadrat "yard"

Write a program/function to calculate the squadrat "yard" from a collection of squadrats. Squadrats is a platform that gamifies outdoor activities by recording which large (~1.6 km square) ...
Steve Bennett's user avatar
8 votes
12 answers
633 views

The Array Walker (part 2)

The Array Walker (part 2) Input: A non-empty array of integers (without nesting1). This can have negative values! Output: A boolean value2 indicating whether we can reach the end of the array when ...
QOO-OOKALAN's user avatar
9 votes
4 answers
538 views

Triangular Transposition Cipher

A text that can be arranged triangularly in some fashion can be read back in some other fashion effectively enciphering it. Narrowing down a set of plausible triangular numberings allows to ...
Domenico's user avatar
  • 2,463
8 votes
22 answers
851 views

Can we escape from array?

Can we escape from the array? Input: A non-empty array of non-negative integers (without nesting1). Output: A boolean value2 indicating whether we can reach the end of the array when starting from the ...
QOO-OOKALAN's user avatar
13 votes
7 answers
933 views

Traverse the list

Update 2025-06-04: Thanks for the submissions everyone! It seems like a lot of the solutions are quite slow / timeout for the 100 length test case, so I don't think any will be able to do the 10k. ...
Ted's user avatar
  • 1,157
9 votes
16 answers
815 views

Maximum contiguous subarray average

Take an array of integers and an integer K. For all contiguous subarrays of length at least K, return the maximum average value (sum of all elements in the subarray divided by length of subarray, ...
Redz's user avatar
  • 619
10 votes
6 answers
808 views

Optimal Assembly Jump Distance

In some forms of assembly, there are separate "short jump" and "long jump" instructions. However, these jumps can themselves have different lengths, which can affect the distance ...
mousetail's user avatar
  • 14.3k
7 votes
8 answers
930 views

Implement PHMINPOSUW (Packed Horizontal Word Minimum)

PHMINPOSUW (Packed Horizontal Word Minimum) is a specialized x86 instruction that finds the minimum value and location of a 16-bit unsigned integer in an 8-element vector packed into a 128-bit ...
bigyihsuan's user avatar
  • 11.3k
4 votes
1 answer
277 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 ...
Weird Glyphs's user avatar
12 votes
9 answers
987 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 ...
l4m2's user avatar
  • 32k
12 votes
8 answers
810 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 ...
caird coinheringaahin g's user avatar

15 30 50 per page
1
2 3 4 5
56