# All Questions

12,639 questions
Filter by
Sorted by
Tagged with
43answers
9k views

### Reverse Polish notation

You must evaluate a string written in Reverse Polish notation and output the result. The program must accept an input and return the output. For programming languages that do not have functions to ...
12answers
846 views

### Compute modular inverse

Given two positive numbers $x$ and $n$ with $x<2^n$, write the shortest possible function to compute $x^{-1} \mod 2^n$. In other words, find $y$ such that $xy=1 \mod 2^n$. Your ...
2answers
1k views

### Slot Machine Hacker

Problem: Slot Machine Hacker from Facebook Hacker Cup 2011 Round 1B Goal: Shortest code in your favourite language using stdin/stdout. You cannot assume ...
4answers
921 views

### Freely available books for code golfing? [closed]

Can you recommend any freely available books about code golfing in general and especially in Java and C++?
49answers
6k views

### Tips for golfing in PowerShell

What general tips do you have for golfing in Windows PowerShell? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to PowerShell (e.g. "...
13answers
17k views

### Drawing a cube in ASCII art

Task description: Draw a cube in ASCII art in roughly a cabinet projection. Monospaced fonts often have characters that are about twice as high as they are wide. ...
33answers
3k views

### Print largest integer you can with the fewest characters [closed]

Find a way to output a large integer with few characters. Solutions will be scored based on the magnitude of the number and shortness of code. EDIT: Let's impose a time limit of a minute on sensible ...
35answers
2k views

### Finding "sub-palindromes".

The shortest code that finds all unique "sub-palindromes" of a string, that is: any substring with length > 1 that is a palindrome. eg.1 ...
55answers
17k views

### Tips for code-golfing in C#

What general tips do you have for golfing in C#? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C# (e.g. "remove comments" is not an ...
53answers
4k views

### 196 algorithm code golf

Write a short program for 196-algorithm. The algorithm starts from an integer, then adds its reverse to it until a palindrome is reached. e.g. ...
1answer
998 views

### Shortest path in a graph

Write a program to take a graph (from either standard input or a file, your choice) and find a shortest path in the graph. Graphs are specified using the following format: ...
3answers
416 views

### Compress programs

Write a program/script that decompresses and passes any compressed data appended at the end of the binary/file as standard input to a program specified as arguments. ...
1answer
710 views

### Write a compressing util for gzip files

The task of this challenge is as following: Write a program that reads a file of reasonable size (let's say <16 MB) from stdin or anywhere else (however you like, but must not be hardcoded), and ...
28answers
16k views

### Tips for golfing in C++

What general tips do you have for golfing in C++? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C++ (e.g. "remove comments" is not ...
25answers
28k views

### Morse code translator

Write the shortest program to transform the standard input into Morse code. Characters not in the table should be printed as they are.
1answer
5k views

### Poisson random number generator [closed]

What is the shortest function (implemented in C) that will return a random draw from a Poisson distribution (given the mean or λ parameter)? ...
2answers
3k views

### Test if a given number is a Vampire Number [duplicate]

EDIT: In the interest of increasing the complexity, i've added more to the challenge. In mathematics, a vampire number (or true vampire number) is a composite natural number v, with an even ...
5answers
871 views

### Tree traversal.

Write the shortest code that traverses a tree, breadth-first. Input any way you like Output a list of "names" of the nodes in correct order.
51answers
5k views

59answers
6k views

### ROT-13 transform standard input

Task Read a string of characters and produce the ROT13 of it. All characters besides [a-zA-Z] should be output verbatim. Each letter in the output may be in any ...
117answers
21k views

### 99 Bottles Of Beer [closed]

Recreate '99 bottles of beers on the wall'. The desired output is this: ...
5answers
5k views

### Just Another Perl Hacker [closed]

Classic code golf challenge. Write the most obscure Perl program to print "Just another Perl hacker". Here's the Wikipedia article on it. Bonus points if it fits in 3 lines / 70 characters each.
111answers
17k views

### Code Golf Christmas Edition: How to print out a Christmas tree of height N

Given a number N, how can I print out a Christmas tree of height N using the least number of code characters? ...

15 30 50 per page