Quantcast
Channel: Active questions tagged code-challenge - Code Golf Stack Exchange
Browsing latest articles
Browse All 196 View Live

Write Moby Dick, approximately

Here is a 1.2Mb ASCII text file containing the text of Herman Melville's Moby-Dick; or, The Whale. Your task is to write a program or function (or class, etc. -- see below) which will be given this...

View Article


Input single positive integer N and print N-th line of your code

It is kind of quine.You should write a program or function that receives a positive integer N as input and prints out Nth line of your code. If N is larger than number of lines of your code, then you...

View Article


Print the Lost numbers

As a big fan of the Lost TV series, I always got intrigued by the sequence of numbers that repetitively appears on the episodes. These numbers are:\$ 4, 8, 15, 16, 23, 42\$ (A104101)Using any...

View Article

One OEIS after another

As of 13/03/2018 16:45 UTC, the winner is answer #345, by Khuldraeseth na'Barya. This means the contest is officially over, but feel free to continue posting answers, just so long as they follow the...

View Article

Emoticon numbers!

(related)Your challenge is to output the highest number you can. You can output as a number or as a string. You must output something that matches the regex ^\d+$, as in only 0-9. The TwistYour source...

View Article


Fault-Tolerant Hello World

At the end of your interview, the Evil Interviewer tells you, "We make all of our applicants take a short coding test, to see if they really know what they are talking about. Don't worry; it's easy....

View Article

Same code different characters

Note: This challenge only allows answers in compiled languagesTaskYour task is pretty simple, make two different programs that when compiled result in the same output.ScoringHere is where the fun comes...

View Article

All your base 97 are belong to us

Many programming languages are written using solely printable ASCII, tabs and newlines. These 97 characters are then stored in 8-bit bytes (which are actually capable of holding 256 different...

View Article


Repeat your program to print Fibonacci numbers

Write a program fragment so that, when repeated N times it prints the Nth Fibonacci number. For example, if your program is print(x) then:print(x) should print 1print(x)print(x) should print...

View Article


What are the five most powerful characters in your language?

Choose any five characters your language supports. There are 5! = 5×4×3×2×1 = 120 ways these can be arranged into a 5-character string that contains each character once; 120 permutations.Choose your...

View Article

When was this language released?

Your challenge is simple. You need to write a program that prints to either STDOUT or a file the year the language it is written in was released. Because this is such a simple task, the twist is that...

View Article

BigNum Bakeoff Reboot

Some of you may be familiar with the BigNum Bakeoff, which ended up quite interestingly. The goal can more or less be summarized as writing a C program who's output would be the largest, under some...

View Article

Give me an OEIS member

Inspired by this challengeIn this challenge, you must write a program that, when given the identifier of an OEIS sequence in any reasonable format, must correctly give an integer in that sequence, for...

View Article


Compress to Impress

Inspired by both the challenge "Unique is Cheap" by @Laikoni, where the score is based on the challenge itself, as well as the JavaScript (ES6) answer of @ETHproductions for the "Palindrome...

View Article

Print a string in as few distinct characters as possible

The task is simple: print The quick brown fox jumps over the lazy dog using as few distinct characters in your source code as possible.print "The quick brown fox jumps over the lazy dog" has a score of...

View Article


Encode a program with the fewest distinct characters possible

The goal is to write a program that encodes an other program (input) with the fewest character possible.ScoringThe score is equal to the different number of characters needed for the output.Lower score...

View Article

Blind Random Sort

Here's a pretty common pattern for sorting algorithms:def sort(l): while not is_sorted(l): choose indices i, j assert i < j if l[i] > l[j]: l[i], l[j] = l[j], l[i]These algorithms work well...

View Article


Bomby Popcorn - Challenge (Ended)

Note:Challenge ended.The winner for accuracy is: Jonathan Allan for answer: ȧ÷¥/€M)FÆṁ.And the winner for one-second intervals is: Tegah D Oweh for answer: ±/+≡(±⧈-≡(↥0⌊/÷-1_0)).All other people with...

View Article

Avoid repeating letters between five simple programs

Your challenge is to write 5 different full programs for the 5 following tasks:Print Hello, World!.Given an input on STDIN, output the factorial (you can assume that the input is an integer ≥ 0).Given...

View Article

Cops: The Hidden OEIS Substring

This is a Cops and Robbers challenge. This is the cop's thread. The robber's thread is here.As a cop, you must pick any sequence from the OEIS, and write a program p that prints the first integer from...

View Article

"As we travel the universe..."

You'll be given the name of one of the 20 biggest objects in the Solar System. Your task is to return an approximation of its radius, expressed in kilometers.This is a code-challenge where your score...

View Article


What is the smallest positive base 10 integer that can be printed by a...

I think the question as above is clear, but just in case:Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline.Qualifying programs...

View Article


Largest Number Printable

Your goal is to write a program that prints a number. The bigger the number, the more points you'll get. But be careful! Code length is both limited and heavily weighted in the scoring function. Your...

View Article

Golf Numerical Representations in Compressed Barbrack

Aside: there are actually multiple ways I thought of implementing a Barbrack-golfing challenge, but this one seemed to have a good balance in testingsitting still and thinking hard about it.The...

View Article

Hunt the Wumpus

When I was a lad, kids would wander into computer stores and play Hunt the Wumpus until the staff kicked us out. It was a simple game, programmable on the home computers of the mid-1970s, machines so...

View Article


List Sophie Germain primes

The QuestionA Sophie Germain prime is a prime \$p\$ such that \$2p+1\$ is prime as well. For example, 11 is a Sophie Germain prime because 23 is prime as well. Write the shortest program to calculate...

View Article

Image may be NSFW.
Clik here to view.

Without using numbers, get the highest salary you can. But don't exaggerate!

As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by...

View Article

Source permutation

A permutation of a set \$S = \{s_1, s_2, \dotsc, s_n\}\$ is a bijective function \$\pi: S \to S\$. For example, if \$S = \{1,2,3,4\}\$ then the function \$\pi: x \mapsto 1 + (x + 1 \mod 4)\$ is a...

View Article

Image may be NSFW.
Clik here to view.

Counting Grains of Rice

Consider these 10 images of various amounts of uncooked grains of white rice.THESE ARE ONLY THUMBNAILS. Click an image to view it at full size.A:B:C:D:E:F:G:H:I:J:Grain Counts:A: 3, B: 5, C: 12, D: 25,...

View Article



Image may be NSFW.
Clik here to view.

Paint Starry Night, objectively, in 1kB of code

Note: a 1000 point bounty is still available for this challenge, which I will create and award if anyone takes the top score without using built-in compression.Below is a 386x320 png representation of...

View Article
Browsing latest articles
Browse All 196 View Live


Latest Images