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
21
votes
9answers
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 ...
22
votes
10answers
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 ...
21
votes
3answers
663 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 ...
32
votes
3answers
4k views

Area of a Self-Intersecting Polygon

Consider a potentially self-intersecting polygon, defined by a list of vertices in 2D space. E.g. ...
20
votes
4answers
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 ...
30
votes
13answers
6k views

Multiply two numbers without using any numbers

You are given as input two strings representing positive integers in base 10, such as "12345" and "42". Your task is to output a ...
11
votes
3answers
761 views

Given r and n, find first n numbers of x where moving first digit of x to last gives x/r = y

Objective Given input r and n find the first n natural numbers ...
24
votes
21answers
7k 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. ...
22
votes
14answers
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 ...
28
votes
5answers
2k views

Shortest common superstring

Given a list of strings s_0, s_1, ..., s_n find the shortest string S that contains each of ...
38
votes
3answers
23k views

Solve Rubik's cube

Write the shortest program that solves Rubik's cube (3*3*3) within a reasonable amount of time and moves (say, max. 5 seconds on your machine and less than 1000 moves). The input is in the format: <...
9
votes
1answer
727 views

Compress data with context free grammars

It is possible to compress some kinds of data, such as human text or source code, with straight-line grammars. You basically create a grammar whose language has exactly one word – the uncompressed ...
40
votes
9answers
6k views

Text compression and decompression — "Nevermore."

With the recent discussion about the use of compression tools in code golf, I thought it would be a nice challenge to write your own text compressor and decompressor. Challenge: Write two programs: ...
8
votes
2answers
244 views

BWInf 2011, question 5: Twin towns

This is a challenge that was originally a tas for the German Bundeswettbewerb Informatik (federal competition of computer science [?]), a competition for highschool students. As opposed to the ...
8
votes
2answers
2k views

Find 10 large prime numbers with n digits

You are given n (200 ≤ n < 250) as a command line argument. Print 10 prime numbers with n digits. Your program should run under 1s and must be shorter than 5000 bytes (excluding). Sum the ...
12
votes
1answer
1k views

Code 39 Barcode Scanner

Code 39, developed in 1974, is one of the most commonly used symbologies, or types, of barcodes, although it is the UPC/EAN system that is most often seen in retail sales. Code 39 barcodes can encode ...
-4
votes
6answers
1k views

Find sum of odd numbers

Write a program to find the sum of all odd numbers between a given range [a,b]. Input consists of a single line containing two integers a and b separated by a space. 0 ≤ a,b ≤ 1,000,000,000,000. Your ...
23
votes
25answers
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 ...
16
votes
9answers
3k views

Calculate digits of Pi

This is a somewhat different task. Calculate 1024 hexadecimal digits of π, beginning at the 1024th hexadecimal place. Formally: Your program should complete in less then 1 minute and produce the ...
19
votes
5answers
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 ...
9
votes
12answers
3k views

Square free Numbers

Given a number N, write the shortest complete program to find the number of square-free integers below N. Sample Input 100000 Sample Output 60794 Constraints: ...
15
votes
4answers
3k views

Roman numeral converter function

Create the shortest function to convert a string of Roman numerals to an integer. The rules for each letter can be found at the Wikipedia page. Letters above 1,000 will have parentheses placed ...
23
votes
17answers
4k 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 ...
82
votes
191answers
18k views

Find the Factorial!

Create the shortest program or function that finds the factorial of a non-negative integer. The factorial, represented with ! is defined as such $$n!:=\begin{...
32
votes
16answers
4k views

Calculate 500 digits of pi

Write a program to calculate the first 500 digits of pi, meeting the rules below: It must be less than 500 characters in length. It cannot include "pi", "math.pi" or similar pi constants, nor may it ...
24
votes
12answers
5k views

Hamming numbers

Given a positive integer, print that many Hamming numbers, in order. Rules: Input will be a positive integer \$n \le 1,000,000 \$ Output should be the first \$n\$ terms of https://oeis.org/A051037 ...

1
2