# Questions tagged [restricted-time]

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

93 questions
Filter by
Sorted by
Tagged with
22k views

• 4,087
5k views

### Last non-zero digit of n!

Given an integer 1 ≤ N ≤ 1,000,000 as input, output the last non-zero digit of N!, where ! is the factorial (the product of all numbers from 1 to N, inclusive). This is OEIS sequence A008904. Your ...
• 4,579
5k views

### Hamming numbers

Hamming numbers are numbers which evenly divide a power of 60. Equivalently, their prime factors are all $\le 5$. Given a positive integer, print that many Hamming numbers, in order. Rules: Input ...
• 1,267
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 ...
• 39.1k
3k views

### Find the prime factors

In this task, you have to write a program, that computes the prime factors of a number. The input is a natural number 1 < n < 2^32. The output is a list of the prime factors of the number in the ...
• 10.1k
10k views

### Check if a number is a product of consecutive integer numbers

Some numbers such as: 6, 12, 20, 30, 42, 56, 60, 90, 120 and so on as can be expressed as a product of consecutive integer numbers as shown below. ...
• 371
933 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 ...
• 248
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 ...
• 6,246
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 ...
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 ...
• 9,901
964 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, ...
• 46.2k
4k views

### Four Squares Together

Lagrange's four square theorem tells us any natural number can be represented as the sum of four square numbers. Your task is to write a program that does this. Input: A natural number (below 1 ...
• 12.1k
1k views

### Calculating Collatz Cousins

Define the function f(n) for a positive integer n as follows: n / 2, if n is even 3 * n + 1, if n is odd If you repeatedly apply this function to any n greater than 0, the result always seems to ...
• 38.5k
1k views

### The Combinatorics of Transistor

The video game Transistor features a very interesting ability system. You collect 16 "Functions" which you can use in 16 different slots. What's interesting is that there are 3 types of slots and ...
• 196k
1k views

### Last Nonzero Digits of a Factorial in Base

You should write a program or function which given three positive integers n b k as input outputs or returns the last k digits ...
• 20.8k
1k views

### Each step of the Levenshtein distance

In this challenge you will write a program that takes two newline-separated strings, s1 (the first line) and s2 (the second line), as input (STDIN or closest). You can assume that the length of s1 ...
• 8,112
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 ...
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 ...
• 4,957
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 ...
• 6,982
679 views

### Reaching one's lucky numbers in reputation

A new code-golfer, Joe, just registered to the site. He has 1 reputation but determined to reach all his lucky numbers in reputation exactly. Joe believes in higher powers which will help him to ...
• 20.8k
936 views

### How should I tile my kitchen?

I recently ordered some new and colorful tiles to replace my boring old white tiling for my kitchen. However, when the tiles arrived, they were all in a weird shape! Therefore, I need a program to ...
• 14.4k
2k views

### The Tic Tac Toe Dictionary

A TicTacToe game can be represented by a string denoting the sequence of positions as the players make their move. 0 1 2 3 4 5 6 7 8 Assume ...
• 2,208
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 ...
• 3,831
623 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 \...
• 34.5k
378 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 ...
• 145k
584 views

### Counting Fountains

A fountain is arrangement of coins in rows so that each coin touches two coins in the row below it, or is in the bottom row, and the bottom row is connected. Here's a 21 coin fountain: Your challenge ...
• 41.9k
2k views

### The Fatal Error Challenge

Objective Write a routine that accepts a string of printable ASCII characters, s, and returns a string containing the same characters as s, reordered so that no two-character substring appears more ...
• 3,691
511 views

### Maximal Substring Construction

In this challenge, you are passed two things: A string length, N A list of strings, L, each with an assigned point value. Any ...
• 14.4k
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 ...
• 39.1k
717 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 ...
• 8,659
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 ...
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 ...
• 191k
1k views

### Find The Wordiest Combination Lock

I have a combination padlock which has letters instead of numbers. It looks like this: http://pictures.picpedia.com/2012/09/Word_Combination_Padlock.jpg There are 5 reels, each of which has 10 ...
• 183
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 ...
• 2,579