Questions tagged [restricted-time]

For challenges with a restriction on the amount of time a submission is allowed to use.

Filter by
Sorted by
Tagged with
11 votes
20 answers
5k views

Calculate 500 digits of e

Write a program to calculate the first 500 digits of the mathematical constant e, meeting the rules below: It cannot include "e", "math.e" or similar e constants, nor may it call ...
Simd's user avatar
  • 2,896
16 votes
10 answers
1k views

Find the longest permutations of integers from 1..k such that all neighbouring pairs sum to a square

OEIS A090461 details the ‘numbers k for which there exists a permutation of the numbers 1 to k such that the sum of adjacent numbers is a square’. This has also been the subject of Matt Parker’s ...
Nick Kennedy's user avatar
  • 21.1k
8 votes
2 answers
274 views

Implement Level-Index Addition

Level-index is a system of representing numbers which has been proposed as an alternative to floating-point formats. It claims to virtually eliminate overflow (and underflow, in its symmetric form) ...
att's user avatar
  • 20.4k
8 votes
1 answer
420 views

Next Special String

Special String We call a binary string \$S\$ of length \$N\$ special if : substring \$S[0:i+1]\$ is lexicographically strictly smaller than substring \$S[i+1:N]\$ for \$ 0\leq i\leq N-2\$, Note: \$ ...
cheems's user avatar
  • 619
5 votes
0 answers
246 views

Find the best character arrangement

You want to write your English essay. However, all characters on your keyboard broke other than the arrow keys and the enter key. You want to find out how to place the characters so you can write your ...
Command Master's user avatar
17 votes
3 answers
1k views

Solve Rubik's Clock

Rubik's Clock is a round(ish) puzzle with two flat sides. On each side, front and back, there are 9 clock faces, arranged on a 3x3 grid. In addition, there are 4 pegs (switches) in between the clock ...
Jitse's user avatar
  • 6,996
8 votes
1 answer
217 views

Is this a Hamiltonian cycle?

There is a 3x3 square block made of 1x1 square blocks, with coins in each 1x1 block, starting from top left block you want to collect all the coins and return to top left block again, if possible ...
cheems's user avatar
  • 619
-5 votes
3 answers
511 views

Code golf edit distance up to 3 [duplicate]

The edit distance between two strings is the minimum number of single character insertions, deletions and substitutions needed to transform one string into the other. This task is simply to write code ...
user avatar
20 votes
12 answers
3k views

Fastest draw in the west! [closed]

We're going rootin' tootin' cow-poke shootin! This is a simple contest, first program to draw their pistol wins. How it works: I require 2 things from you, an executable, and a command to be run from ...
tuskiomi's user avatar
  • 3,831
24 votes
6 answers
1k views

Can this pattern be made with dominoes?

Given a pattern of squares on a grid, determine if it is possible to create that pattern with non-overlapping dominoes. In case you are not familiar, a domino is a rectangular shape created by joining ...
Beefster's user avatar
  • 9,931
20 votes
9 answers
625 views

Zeroes at end of \$n!\$ in base \$m\$

Related: Zeroes at the end of a factorial Today, we are going to calculate how many zeroes are there at the end of \$n!\$ (the factorial of \$n\$) in base \$m\$. Or in other words: For given integers \...
tsh's user avatar
  • 34.7k
11 votes
10 answers
815 views

Find the number of ways to climb a stairway

Challenge: Find the number of ways to climb some stairs with n steps and with some limitations. You should be able to run the tests below on TIO https://tio.run/ without timing out. – 60 seconds. (...
Kjetil S's user avatar
  • 5,887
24 votes
9 answers
935 views

Animal-Alphabetical Sequence

The Animal-Alphabetical Sequence is an infinite string of letters built accordingly to the following procedure: Start with the letter A; Replace each letter with ...
Jyenas's user avatar
  • 248
13 votes
7 answers
722 views

Iterate over the neighborhood of a string

Input A string S of length between 2 and 30. The only letters in the string will be a or b. Output All strings within ...
user avatar
15 votes
10 answers
2k views

When does hh:mm = mm.ss?

Let's begin with a thought experiment. You have a clock and a timer, in which you start the timer when the clock shows exactly hh:mm.00. Clock: The clock employs ...
user avatar
11 votes
4 answers
418 views

Holey Knight's Tour

Given a rectangular board of cells with some number of holes in it, determine whether it is possible to complete a "holey knight's tour" (That is, a path that visits every non-hole cell exactly once ...
Beefster's user avatar
  • 9,931
20 votes
2 answers
382 views

Exactly N in a line

Given a number N from 2 to 8, place any nonzero number of queens on a grid of any size so that every queen has exactly N queens (counting itself) in each of its row, column, and each diagonal. This ...
xnor's user avatar
  • 145k
11 votes
2 answers
640 views

Are these two DFAs equivalent?

Two Deterministic Finite Automata or DFAs can be checked to see if they accept same set of strings in polynomial time. See section 3.3 of this for a long list of methods and this SO question/answer ...
user avatar
2 votes
5 answers
192 views

Shift the digits [closed]

Here, x (supplied as input) and n (the result of your computation) are both positive integers. n * x = n shifted. Find n. Here's an example of shifting: ...
user avatar
5 votes
3 answers
411 views

Choose 3 strings and output the exact minimum Hamming distance between any pair

Consider \$3\$ binary strings of length \$n\$ chosen independently and uniformly at random. We are interested in computing the exact expected minimum Hamming distance between any pair. The Hamming ...
user avatar
19 votes
2 answers
725 views

Counting creatures on a hexagonal tiling

This challenge will have you count "creatures" in the tile game Palago. A creature is any closed shape that can be formed by Palago tiles of matching colour in a hexagonal grid. The game Palago ...
Peter Kagey's user avatar
  • 8,679
8 votes
4 answers
708 views

Find X,Y,Z coordinates from index

Introduction I began studying the Collatz Conjecture And noticed these patterns; 0,1,2,2,3,3...A055086, and 0,1,2,0,3,1...A082375, in the numbers that go to 1 in one odd step, 5,10,20,21,40,42......
PrincePolka's user avatar
-6 votes
5 answers
147 views

Report divisibility with arithmetic integer operations only [closed]

Given two numbers, the first is greater than the second, check whether the first number is divisible by the second without a remainder. If divisible, answer "yes"(...
Mouvre's user avatar
  • 99
-4 votes
6 answers
2k views

Output first \$n\$ digits of \$\pi^{1/\pi}\$

This challenge is to produce the shortest code for the constant \$\pi^{1/\pi}\$. Your code must output the first \$n\$ consecutive digits of \$\pi^{1/\pi}\$, where \$n\$ is given in the input. ...
user avatar
11 votes
6 answers
1k views

Which really big number is bigger?

This question is tricky (and in particular harder than Which big number is bigger?), for those who like more challenging puzzles. Input Integers a1, a2, a3, a4, a5, b1, b2, b3, b4, b5 each in the ...
user avatar
9 votes
10 answers
920 views

Next number with k fives

Challenge: Your program will take two integers n and k as input, and output the smallest integer greater than (but not equal to)...
jean's user avatar
  • 485
17 votes
3 answers
1k views

Plight of the Concorde

Background The traveling salesman problem (TSP) asks for the shortest circuit that visits a given collection of cities. For the purposes of this question, the cities will be points in the plane and ...
A. Rex's user avatar
  • 2,579
18 votes
10 answers
2k views

Reciprocal copycats

Let \$A\$ be a positive integer consisting of \$n\$ decimal digits \$d_1,d_2,...,d_n\$. Let \$B\$ be another positive integer. For the purpose of this challenge, we call \$A\$ a copycat of \$B\$ if ...
Arnauld's user avatar
  • 192k
23 votes
23 answers
4k views

Encode - Shuffle - Decode

Challenge Your task is to encode an integer as a string of ASCII characters, then successfully decode it after said string has been randomly shuffled. You will write two programs/functions, which ...
Delfad0r's user avatar
  • 6,266
9 votes
0 answers
468 views

The N Queens Problem, but with Fairy Chess Pieces

Fairy Chess is a sort of generalized chess that allows unconventional pieces. The eight queens puzzle is a classic problem where you have to put 8 queens on a chess board such that no two queens ...
Beefster's user avatar
  • 9,931
21 votes
11 answers
2k views

Fruit bagging factory

Your mission is to build an algorithm (program or function) that can optimize packing fruit from a conveyor belt into bags to be sent off to retailers, optimizing for a largest number of bags. Each ...
Angs's user avatar
  • 4,987
13 votes
7 answers
504 views

Cutpoints in a maze

A maze is given as a matrix of 0s (walls) and 1s (walkable space) in any convenient format. Each cell is considered connected to its 4 (or fewer) orthogonal neighbours. A connected component is a set ...
ngn's user avatar
  • 15.3k
11 votes
2 answers
2k views

Solve a Rubik's Cube

Your challenge is to write a program to solve a 3x3x3 Rubik's Cube. This challenge is based on this one from 2013, rewritten to adhere to current community standards, and reposted with the original ...
MD XF's user avatar
  • 13.9k
10 votes
6 answers
842 views

Output all distinct permutations of a vector

Challenge: Output all distinct permutations of a, potentially long, list of positive integers. You may assume that the vector has less than 1,000 numbers when testing, but the process should in ...
Stewie Griffin's user avatar
19 votes
7 answers
2k views

Number of distinct non-empty subsequences of binary expansion

A subsequence is any sequence that you can get from another by deleting any amount of characters. The distinct non-empty subsequences of 100 are ...
orlp's user avatar
  • 39.1k
34 votes
6 answers
3k views

Finding Snakes in a Matrix

Challenge Given a binary matrix and a binary string, determine if that binary string can be found starting at any point in the matrix and moving in any direction at any subsequent point to form the ...
hyper-neutrino's user avatar
  • 42.4k
23 votes
28 answers
2k views

Count forth and back then double up

Let's count... Count up to 2 and back to 1 Count up to 4 and back to 1 Count up to 6 and back to 1 ... ok you got it... put all these together and you'll get the following sequence ...
user avatar
57 votes
16 answers
9k views

Extreme Fibonacci

There have been a billion iterations of Fibonacci challenges on this website, so lets spice things up with a Fibonacci challenge of a billion iterations! Your challenge is to output the first 1000 ...
user1502040's user avatar
  • 3,829
19 votes
7 answers
1k views

Fastest tweetable integer factorizer

The task is to find a non-trivial factor of a composite number. Write code that finds a non-trivial factor of a composite number as quickly as possible subject to your code being no more than 140 ...
user avatar
15 votes
4 answers
1k views

Square root a number

The task is as follows: Given a positive integer x and a prime n > x, output the smallest positive integer ...
user avatar
21 votes
9 answers
4k views

Compute the inverse of an integer modulo 100000000003

The task is the following. Given an integer x (such that x modulo 100000000003 is not equal ...
user avatar
12 votes
2 answers
641 views

Find a number which generates all the integers mod q

Consider the integers modulo q where q is prime, a generator is any integer 1 < x < q ...
user avatar
16 votes
2 answers
382 views

Output a primitive element for each field size

A primitive element of a finite field is a generator of the multiplicative group of the field. In other words, alpha in F(q) is ...
user avatar
14 votes
7 answers
900 views

Finding the smallest sets

Consider three sets A, B and C each containing n ...
user avatar
39 votes
19 answers
7k views

11 = (1+2+3+4+5) - (1+2+3) + (6) - (4)

Given a positive integer N, your task is to return the number of steps required by the following algorithm to reach N: Find the smallest triangular number Ti such that Ti ≥ N. Build the ...
Arnauld's user avatar
  • 192k
23 votes
2 answers
966 views

Optimize sorting, using "Sub-vector reversals"

This is a fewest-operations challenge where the objective is to sort a vector into ascending order using the fewest reversals. Your algorithm can only sort the vector using "sub-vector reversals"1, ...
Stewie Griffin's user avatar
28 votes
19 answers
2k views

Find the sortable years

The year 2013 had an interesting property: the digits are consecutive when sorted (0123). Let's call this type of number a sortable number: a non-negative integer whose base-10 digits are consecutive ...
ETHproductions's user avatar
21 votes
3 answers
2k views

Piet (Mondrian)'s Puzzle

For more information, watch this video, and go to A276523 for a related sequence. The Mondrian Puzzle (for an integer n) is the following: Fit non-congruent ...
clismique's user avatar
  • 6,980
25 votes
6 answers
1k views

Fraction to exact decimal

Write a program or function that given two integers a, b outputs a string containing a decimal number representing the fraction a/b exactly. If a/b is integer, simply output the value, without a ...
orlp's user avatar
  • 39.1k
44 votes
69 answers
4k views

Fibonacci-orial

Definition Fibonacci sequence F(n), on the positive integers, are defined as such: ...
Leaky Nun's user avatar
  • 49.7k