instruction stringlengths 34 53.1k |
|---|
You need to write a program in any language that will produce (source code for) a program in a different language. That program will produce a 3rd program in another language and so on.
You should aim to create many programs; you aren't limited to 3. You can re-use a language, but it won't be counted in the scoring.
Yo... |
The formula on the wiki article for cyclic numbers can be used to generate cyclic numbers in any base. Using this formula, or any other appropriate formula, compute the first ten cyclic numbers in base 10. (The numbers cannot simply be stored and read out, even if the encoding is obscure or novel.)
Repeated cyclic numb... |
The challenge is to parse a string like Python does and print the contents of the string.
Input (command-line argument or stdin): a string literal (e.g. "hello") (or multiple literals, see string literal concatenation below)
Output (stdout): the contents of the string (e.g. hello)
Rules for parsing the string:
A str... |
Create a function that will take two strings as input and return a single output for the result. Most popular answer wins.
The rules of Rock-paper-scissors-lizard-Spock are:
Scissors cut paper
Paper covers rock
Rock crushes lizard
Lizard poisons Spock
Spock smashes scissors
Scissors decapitate lizard
Lizard eats pape... |
This is tangentially related to my quest to invent an esoteric programming language.
A table of the binary numbers 0 .. 15 can be used to implement a Universal Binary Function using indexing operations. Given two 1-bit inputs X and Y, all 16 possible functions can be encoded in a 4-bit opcode.
X Y F|0 1 2 3 4 5 6 7 8 ... |
Problem statement
The task is to write the shortest R statement to count the cells (rows * cols) in an instance of the R type numeric data.frame. For example, the data.frame which would be displayed as
a b c
1 1 2000 NA
2 2 2000 NA
3 3 2000 1
4 4 2000 Inf
has 12 cells.
Input
The data.frame is supplied in variabl... |
Write a class containing a method with the signature
System.Array ChangeElementType(System.Array jaggedArray)
(you may rename identifiers ChangeElementType, jaggedArray and shorten the type System.Array with using directives). The class may contain any additional members if needed.
You may assume the following precond... |
Challenge: Implement incrementation without addition, multiplication, exponentiation, and any higher binary operators (and their opposites) in Python.
Winner is the person who can do it in the least amount of code. You score 5 characters less if you can do it for negative numbers and without unary operators.
|
Your task is simple. The program reads in a line of text from the standard input, and it prints out the same text in a character-reversed form. It is not allowed to print anything else.
For example:
input: "Hello!",
output: "!olleH"
The catch is, your program has to be able to do the exact same thing if the source cod... |
The Task
Create a function/subroutine which returns 1. You can make it as elaborate as you like, as long as it returns 1.
The Rules
The entry with the most upvote wins - just like any popularity contest. Good luck!
|
This question is inspired by a similar question first asked on StackOverflow by Florian Margaine, then asked in variant forms on CS by Gilles and on Programmers by GlenH7.
This time, it's a code golf, with specific metrics for success!
In an office of ten people, it's someone's turn to buy croissants every morning. Th... |
Challenge: Write a makefile, which would lead to this behavior:
% make me a sandwich
What? Make it yourself
% sudo make me a sandwich
Okay
Rules:
Should work on a Linux machine, where the user isn't root but allowed to use sudo.
Must not say Okay to any shorter make command (e.g. sudo make sandwich).
The second com... |
Good Evening Ladies and Gentleman.
Tonight - we have a code challenge. A competition that will be defined not in the amount of points (a la Asteroids) but simply whether you can finish it (a la Zelda). And for the sake of comparison, the amount of bytes (uh... but you said...).
Your challenge is to compose a single qu... |
This is the Collatz Conjecture (OEIS A006577):
Start with an integer n > 1.
Repeat the following steps:
If n is even, divide it by 2.
If n is odd, multiply it by 3 and add 1.
It is proven that for all positive integers up to 5 * 260, or about 5764000000000000000, n will eventually become 1.
Your task is to find... |
I hope this kind of "riddle" is ontopic in Programming Puzzles & Code Golf.
Give an example of a situation where the C# method below returns false:
public class Giraffe : Animal
{
public bool Test()
{
return this is Giraffe;
}
}
Rules: The code lines above must not be changed in any way, but you would put th... |
Inspired by this question from electronics.SE, here's a challenge for you:
Write a program or subroutine that takes in a sequence of decimal digits (0 to 9) and speaks them aloud, without using an existing speech synthesis tool.
Input:
You may ask for the input digits to be provided in any reasonable format, e.g. as a ... |
This puzzle works for any programming language that has the same // single-line and /* ... */ multi-line comments that C++, C# and Java do.
You are debugging an application. You find a fishy block of code, which you comment out and replace with some new code:
/*
code block A
*/
code block B
After some debugging, you f... |
Cue Storyline: It is the early 21st century, and most things have become a thing of the past. You and your fellow code-golf-eteers, however, are on a quest to reenact the 1990s. As a part of this challenge, you must recreate a minimalistic chatroom.
The Goal: To create a chatroom with as few bytes as possible. The... |
Find the highest common factor of two(positive integer) input numbers (not greater than 5000) in the minimum number of iterations.
If you use a loop, it should increment a counter, starting at 0 for the first run. The counter should be the first statement in the loop. If you use more than one loop, they too should have... |
In the game 15, two players take turns selecting numbers from 1 to 9 (without choosing any number that either player has already selected). A player wins if he or she has three numbers that add up to 15. If all the numbers have been selected and no combination of either player's adds up to 15, then the game is a tie.
Y... |
A question that had popped up in my head once - how many NAND gates would it take to build a larger, "meta-NAND" gate?
Your task is to build a black-box circuit that takes two input wires A and B and returns one output wire that satisfies A NAND B, subject to the following restrictions:
You must use at least two NAND ... |
Welcome, brave code golfer! Today you will stand in the midst of a great battle between a goblin and an elf!
goblin attacks elf!
elf dodges!
elf attacks goblin!
elf hits goblin for 13 damage!
goblin has 37 health left.
goblin attacks elf!
goblin hits elf for 1 damage!
elf has 49 health l... |
The problem is simple. Given a string such as Hello World! the program would output 8-5-12-12-15 23-15-18-12-4-!. Any delimiters will do, (please specify what they are though) I just chose to use space between words and dashes between characters.
The conversion is that all alphabetical characters will be converted to t... |
Based on my previous question of the same type, Build an adding machine using NAND logic gates, this time you're being asked to multiply instead of add.
Build a diagram of (two-wire) NAND logic gates that will take the input wires A1, A2, A4, B1, B2, B4, representing two binary numbers A to B from 0 to 7, and return va... |
I have a source file here:
#include <FizzBuzz.h>
fizzbuzz
And I want to make "fizzbuzz" turn into a FizzBuzz program solely through the preprocessor.
Your task is to write a FizzBuzz.h that uses only preprocessor directives (things like include, define, etc.) to create a working FizzBuzz program. Specifically, I want ... |
Given an integer k and a list of integers A of size n, find the product of all subsets in A of size k and sum them together.
For example,
k = 2
n = 4
A = 1 2 3 4
The subsets of size 2 and their products are
1 2 = 2
1 3 = 3
1 4 = 4
2 3 = 6
2 4 = 8
3 4 = 12
which sum together to 35.
Some test cases:
Input
A = 73 36 86 ... |
My boss needs to know how long it takes to add together two integers. But, I don't like to work weekends, and I think its fair that my code doesn't either. The problem is, the boss is a demanding guy and thinks I should put in over time to make sure the time it takes stays the same, and I know he is going to check if t... |
Take a classic Boolean function with 4 variables, and perform a Karnaugh simplification (you can use any other method of Boolean algebra to arrive to the simplest form). The catch is: the result has to be displayed as a circuit diagram using ASCII graphics! (in a text-mode grid display, not just characters painted in a... |
An illegal prime is a prime number which encodes information that is illegal to possess - specifically, in one case, a gzip file of the source code of DeCSS, a piece of software to decrypt copy-protected DVDs.
Your task has two phases:
Build a source file that implements DeCSS in as few bytes as possible. This can be ... |
In traditional FizzBuzz, you are asked to print the numbers from 1 to 100, but replacing every multiple of 3 with "Fizz", every multiple of 5 with "Buzz", and every multiple of both 3 and 5 (i.e. 15) with "FizzBuzz".
However, as an evil interviewer, I've invented my own twisted version of FizzBuzz, which I've decided t... |
This is a follow-up to Chess960 position generator.
In Chess960, there are 960 possible starting positions that can be enumerated from 0 to 959 (or, at your choice, from 1 to 960). The enumeration scheme is defined in http://en.wikipedia.org/wiki/Chess960_numbering_scheme:
White's Chess960 starting array can be derive... |
Sometimes people get frustrated on the StackExchange network (specifically SO).
Your task is to create a bookmarklet that causes StackOverflow to explode/implode/destroy in some fashion. This will provide a nicer way of dispersing our frustrations.
The Rules:
it must be in the form of a bookmarklet
must work in Chro... |
NOTE: SIMILIAR TO Solitaire Dreams - Creating a winnable solitaire starting hand
Find a minimum of 5 deck orders where if the cards were dealt out would create a game of Klondike Solitaire where there is absolutely no possible winning state. Assume the game is 3 card draw, infinite times through the deck.
As always, th... |
Your challenge is to write a program that takes input from stdin, creates a set of 1 to ncolors and outputs them on stdout, formatted as a 6-digit-hex value with a prefixed #.
The starting color should have following values (in a hsv colorspace) (pesudocode)
h=rand(), s=0.5, v=0.95.
Every subsequent color should ha... |
My challenge is language-specific, but needs a lot of creativity: write a valid C program with only one pair of braces {} and none of the keywords if, for, while (all checked after preprocessing, and after substituting trigraphs). I'm looking for preprocessor abuse (but other methods are also welcome) to define a new p... |
Summary
Code golf is good. Pie is good. When you put the two together, only good stuff can happen.
Specifications
In this challenge you will manage a pie shop. The user will be able to input five different commands: list, count, buy, sell, and exit. Here are the specifications for each:
list
Print a list of all the p... |
The cow and chicken problem is a traditional problem for introducing young students to the concept of systems of equations. It goes as follows:
A farmer raises cows and chickens on his farm. His animals have a total of 24 heads and 68 legs. How many cows and how many chickens does he have?
The numbers of heads h and ... |
Your task is to build a program (using only printable ASCII characters and/or tabs and newlines) that prints out exactly the characters in the printable ASCII space (0x20 to 0x7e) that don't appear in your program's source code (in any order, however many times you want).
The shortest code to do this in any language wi... |
In this challenge, you must take two numbers (separated by a space) as input and output an ASCII right triangle, made up of xs.
The first number will be the width and height of the triangle you should output. The second number will be which corner the right angle will be in. The corners are numbered 1 to 4, starting in... |
Inspired by this
Implement simple chess bot (with console or GUI) that has following features:
[Pseudo-]graphically showing the board;
Accepting user moves and making their own moves;
Playing by basic chess rules (not doing illegal moves);
Making at least minimally reasonable moves (no random moves, a player making ra... |
Goldbach's conjecture states that every even number > 4 is the sum of two prime numbers. Although this conjecture is not yet proven, similar results have been proven for other series of numbers. For example, every even number can be written as the sum of two practical numbers.
The Challenge
Given a number N, return a... |
Your task is to write a program in x86 machine language (any version you like) that will run through as many instructions as possible and then halt, using a maximum of 32 bytes of code and starting with zeroed-out registers.
You can assume anything about the random-access memory you like, as long as it's in a usable fo... |
The set of ten numbers below:
223092870
17237308840522
1075474925835771
12574206406402195
79458974087499419
265057843710517649
466012798920390527
926434345611831877
1390237791335182649
2336970054109245767
has the property that no two pairs of numbers have the same greatest common factor. (In this case, the greatest co... |
With equations that have more than one unknown, simultaneous equations can be used in solving for them. This challenge will only deal with linear equations with two unknowns, to make things as elementary as possible.
The program should take two lines of input from stdin, each containing a linear equation with two unkno... |
Implement the Fast Fourier Transform in the fewest possible characters.
Rules:
Shortest solution wins
It can be assumed that the input is a 1D array whose length is a power of two.
You may use the algorithm of your choice, but the solution must actually be a Fast Fourier Transform, not just a naive Discrete Fourier ... |
Generate a 7 by 7 grid, filled with random numbers. However, in cells with an odd row and column number (starting at 0), you must use the sum of the surrounding cells. Here's a small example with a 3 by 3 grid (sum-square bolded):
2 2 2
2 16 2
2 2 2
And here's an example 7 by 7 grid:
6 5 4 3 7 2 5
6 43 3 50 8 43 8... |
I recently had to add a small basic calculator to a project. I wrote a quick dirty one, but it seemed small enough to check with you people out here ;)
Just out of curiosity & an appetite to get surprised for some real hacky solutions, try and beat this one :
CODE (JS/JQUERY):
function scalcy() {
var b="", p=parse... |
Australia (and many countries) has a perferential voting system,
where voters, number the candidates from 1 - n, where n is the number of candidates,
in order of preference.
Until a candidate gets a absolute majority of votes, the number 1 votes for the candidate with minimum count of number 1 votes, are redistributed ... |
An old Chinese poem goes:
一百饅頭一百僧,
大僧三個更無爭,
小僧三人分一個,
大小和尚得幾丁?
When translated into English, this math problem reads:
100 buns and 100 monks,
Big monks eat 3 buns with no shortage,
Little monks share one bun among three,
Big and little monks, how many are there?
Once again, like in the cow and chicken... |
The blancmange function is used as an example in basic calculus of a function that is continuous everywhere, but differentiable nowhere. It achieves this effect by using the sums of ever-diminishing triangle-wave functions.
Your task is to build a program that takes a binary fractional number in the interval [0, 1] an... |
The Holy Grail Layout in CSS, is a full height, 3 column layout which consists of a fluid central column, and two side columns with fixed widths.
Your Task is Simple!
Reverse it, make a fixed width central column, and two fluid width columns to the sides. The point is for them to take All available space both verticall... |
There is already a problem on here about calculating the total resistance of a resistor diagram. However, that problem deals only with series-parallel diagrams, which are trivially reducible. Here I present the question that includes nontrivial bridges and the like, and uses a slightly more convenient representation.
Y... |
For reference to the game of Mastermind: Solving Mastermind in 6 or less moves
In the version of Mastermind used in this problem, the operating string is a 4-digit number, from 0000 to 9999, represented as either numbers from 0 to 9999 or strings of consecutive digits "0000" to "9999" in input.
Your task is to build a ... |
So there was a "please do my homework question" on StackOverflow that lead to an idea. As everyone knows loops are quite expensive, in some places they can get as high as $12.99 an iterations, so to save money there shouldn't be any loops.
So, lets do the homework, but in the least intuitive way.
Write a program that ... |
Your task is to build a piece of code that generates an aperiodic sequence of integers, either by outputting one every time it iterates, or by taking an integer n and returning the nth number in that sequence.
Now, the sequence 1, 2, 3, 4, 5, 6, ... is itself aperiodic, so I'm going to introduce a few limitations to th... |
Anyone who is moderately into low level code optimization know about the perils of branching, be it implemented as if-statements, loops or select-statements the possibility of a branch misprediction is a terrible clock-wasting thing.
Simple problems can be solved much better with simple arithmetic, so let's do that.
Fo... |
Given seconds like 11728, write the smallest javascript function that returns a string like 3hrs. 15min. 28sec.
signature textTime([int] t,[bool] z,[bool] m)
t is the time like 11728 and you can assume int
z is optional and true means drop zero times, so 3hrs. 0min. 28sec. becomes 3hrs. 28sec.
m is optional and true me... |
An often-used trick in BF-golfing is something I call "multiply then add." Let's say that you want to initialize the memory to contain a series of numbers, like 87 75 68 96. The simplest way to do this is to simply write out a long series of 326 + signs. A better method, however is below.
++++++++++[>+++++++++>+++++... |
There is a question on the site that asks to implement division without using division.
In my case, I am asking you to do the same, but only using addition.
What this means is basically: addition is the only operator or function allowed that operates on numbers and returns other numbers (i.e. no subtraction, multiplica... |
Inspired by this question
Your challenge is very simple: take input in the form of lookupString string1 string2 ... stringN and output how many pairs of strings there are.
But there's a catch! There are two ways of interpreting "pairs." The first way is combinations. For example,
1 2 3 4
orange ora... |
This blog post about generating random CSS color codes in JavaScript have multiple solutions for generating a random color in JavaScript. The shortest I can find is this:
'#'+(Math.random()*0xffffff).toString(16).slice(-6)
If you are not familiar with CSS color code read documentations here.
Can we do better? What abo... |
Write a program that's as short as possible (as measured by byte-count), takes no input, contains no comments, and outputs a character string/sequence, such that concatenated program+output is exactly 95 characters long and contains every printable ASCII character exactly once, i.e. program+output is a permutation of t... |
Good Afternoon,
Your goal is to, in the least amount of source code bytes, recreate any of Piet Mondrian's 'Composition' paintings (for instance, Composition #10).
The recreation can either use the actual colors, or replace it with the appropriate colours from the Windows Default 16 Color Palette.
Your recreation can b... |
try to write shortest possible variant of logic which converts binary input by this table:
00 -> 00
01 -> 10
10 -> 01
11 -> 11
You can use only bitwise and bitshift operations. I calculate only operations and don't care brackets, spaces, constants and etc. But you can't use any control (if, while, ternary) and arithme... |
The program should print every letter combination (lowercase or uppercase, it doesn't matter) in alphabetic order. It must start with a and the last printed combination should be password.
The output should be:
a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ... passwora passworb passworc password
|
You must take input in the form of
title|line1|line2|(...)|line[n]
And output an information card. It's hard to explain how to make the card, so here's a quick example:
Input
1234567890|12345|1234567890123|pie|potato|unicorn
Output
/===============\
| 1234567890 |
|===============|
| 12345 |
| 123456789012... |
today (24 of September) is birthday of company HONDA. Originally their company name is
本田技研工業株式会社
I want to ask to make a gift for HONDA. The task is to make program print company name. You can do it any way you want, but there is only one rule, Unicode is not allowed. It should be ASCII art.
I want to ask to post co... |
I am working on making a minimalistic personal testing website to conduct various experiments for my role at work. I'd like to add a couple of bells and whistles to it, particularly a slideshow that cycles between several images. I could just as easily grab a plug-in, but I'd like to promote this Stack Exchange beta si... |
I want to give a task. The main rule is not to use the same code again, it means no loops, no jumps, no goto, no recursion, if you declare procedure it can be called only once and etc. Also if you call some standart function it should meet the requirements inside.
The main point of this task is to write the shorter co... |
The task is to write code that can find small logical formulae for sums of bits.
The overall challenge is for your code to find the smallest possible propositional logical formula to check if the sum of y binary 0/1 variables equals some value x. Let us call the variables x1, x2, x3, x4 etc. Your expression should be... |
For this challenge, you must accept input as a comma-separated list (columns) of a run (rows) of the first letters of any of the colors red, orange, yellow, green, blue, or purple, and output (to stdout) the HTML for a table of those colors.
This is fairly hard to understand, so I'll just give a simple example.
Input:
... |
this program has to take two strings and compare their length, then tell you which one is longer (string-a or string-b) and by how much
rules:
no using .length or other built-in length checking methods (duh!)
no using addition or subtraction, this includes improvised addition/subtraction, in case you find some sort of... |
I've never been able to wrap my head around the Monty Hall problem. Here's the premise:
Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No.... |
objective
write a program that can perform addition, subtraction, multiplication, and division, using only bit-wise operators, by bit-wise operators i mean the equivalent of JavaScript &, |, ^, ~, << ,>> ,>>>. (AND, OR, XOR, NOT, and SHIFTs)
rules
you can use other operators, just not for the actual operation/output. ... |
this code looks like a story but does nothing useful. My challenge for you guys is to write piece of code which sounds like another story but it must generate output - another story.
So the point of challenge to make valid code which can be read like a logical story/poem/tale, also it must generate output - another sto... |
The goal is to create a fully compliant converter between the official Unicode encodings as given in the UTF FAQ. Given that this is centred on Unicode, I will accept the answer with the lowest byte count using the best possible of the involved encodings (which will probably be UTF-8, unless maybe you program it in APL... |
This is a simple one. Given the input of a number, return the name and reputation score of the Stack Overflow user with that given ID. Your program can assume that it is always given a valid and existent user ID.
For example: given the input 764357 (which is my userID on StackOverflow) the program would return LegoSto... |
The goal is to read bytes from input encoded in Code Page 437 and output the same characters encoded as UTF-8. That is, bytes should be translated into Unicode codepoints per this table (a particular revision of the Wikipedia article). Bytes 0-31 and 127 are to be treated as graphics characters.
Rules
Input and outpu... |
The challenge is to write code in any open source, available on linux, language of your choice to perform modular exponentiation. The input will be two randomly chosen 2048 bit positive integers numbers x and y and a 2048 bit prime z. Here is a sample snippet of python to compare to.
def pow_mod(x, y, z):
n = 1
... |
Challenge
Write a calculator that takes input in a verbal form (as one might speak an equation) and also outputs in a verbal form (as one might speak a number).
Rules
The calculator should be able to:
add, subtract, multiply and divide
handle operands between negative one million and one million
handle outputs between... |
The goal of this code-golf is to create a code that lets the user input an ASCII string (contains only printable ASCII characters), and your program outputs the lower-case variant of this string.
Important: you are NOT allowed to use a built-in function that converts the string (or just one character) to lowercase (suc... |
The goal of this code golf is to convert integers to English words.
The program prompts for input. If this input isn't an integer, print NaN. If it is an integer, convert it to English words and print these words. Minimum input: 0 (zero). Maximum input: 9000 (nine thousand).
So, 5 returns five (case doesn't matter), ... |
Your mission, if you choose to accept it, is to construct a simple truth evaluator for the following logical operators:
----------------------------------------------------------------------------------
Logical Name | Gate Name | Symbol | Symbol Name | Truth Table
------------------------------------... |
The goal of this Code Golf is to create a program that sorts a list of strings (in ascending order), without using any built-in sort method (such as Array.Sort() in .NET, sort() in PHP, ...). Note that this restriction excludes using a built-in method that sorts an array descending, and then reversing the array.
Some ... |
This is kind of inspired by the Intel 8086 challenge that's also on here, but I thought a 6502 challenge would be interesting too.
The challenge
I thought this would be a fun one to see the results for. This one is obviously towards the more advanced side of the spectrum. The challenge is to write your own 6502 CPU emu... |
You will write a Program which writes the Second Program.
Each program has one Input; which may be a command line argument, or be read from stdin. A Input is a single word made up of upper and/or lowercase letters (a-z)
Each program has Output; which may be to a file, or to stdout.
The Program (which you post here)
... |
May be you know the game of Set (a wonderful game for kids btw) a card game with 81 cards, where each card has a figure on it with 4 different attributes (form , number, colour and fill). Each attribute has 3 different values:
form: wave, oval, diamond
colour: red, purple, and green
number: 1, 2, 3
fill: none, dashed, ... |
Find the shortest mirror quine in a language of your choice.
A mirror quine is a quine whose source code is equal to the reverse of its own source code.
Note:
1) Length of source code should be atleast 2.
2) Quines not allowed are the one whose text can be echoed directly.
Example: Let L' be any language, then a quine ... |
Write the shortest code in any language of your choice to find the \$N\$th \$K\$-ugly number.
A \$K\$-ugly number is a number whose only prime factors are the prime numbers \$\le K\$.
\$K\$-ugly number's are popularly known as \$K\$-smooth numbers.
Constraints:
\$0 < N < 1000\$
\$0 < K < 25\$
Input:
N K (separated... |
Given a list of 2d (x, y) coordinates, determine how many unit squares (edge length 1 unit) can be formed using the coordinates.
Input will be an array of 0 or more pairs of coordinates: e.g. in JavaScript: numofsq([[0,0], [1,0], [1,1], [0,1]])
No duplicate coordinates in input
Input order will be random (random 2d co... |
Write the shortest iterative function to find gcd of two numbers (assume 32 bit numbers).
Rules:
Arithmetic, Comparison and Logical Operators are not allowed (except equality comparison (a==b) operator).
Function should work for both positive and negative numbers
No inbuilt functions allowed.
All bitwise operators all... |
Implement Stopwatch for typing Alphabets
Alphabets = "a b c d e f g h i j k l m n o p q r s t u v w x y z".
Note
The program should run infinitely and should stop only when Esc button is pressed.
The stopwatch starts with keystroke "a" and ends with keystroke "z"
Output is the time taken to type the Alphabets correctl... |
What general tips do you have for golfing in Mathematica? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Mathematica (e.g. "remove comments" is not an answer).
|
Write the shortest code in the language of your choice to perform run length decoding of the given string.
The string will be supplied as input on stdin in the form
CNCNCNCNCNCNCNCN
where each C could be any printable ASCII character and each N is a digit 1 to 9 (inclusive).
Sample input:
:144,1'1
Corresponding outpu... |
There are N doors and K monkeys. Initially, all the doors are closed.
Round 1: The 1st monkey visits every door and toggles the door (if the door is closed, it gets opened it; if it is open, it gets closed).
Round 2: The 1st monkey visits every door and toggles the door. Then The 2nd monkey visits every 2nd door and ... |
Given a sequence of numbers, find the minimum number of jumps to go from the starting position to the end and come back to the starting position again.
Each element of the sequence denotes the maximum number of moves that one can move from that position.
At any position, you can make a jump of at max k moves, where k i... |
The goal of this code golf is to create an interpreter for the programming language HQ9+
There are 4 commands in this programming language:
H - prints "Hello, world!"
Q - prints the source code of the program
9 - prints the lyrics of the song "99 bottles of beer"
+ - increments the accumulator
The rules:
Because the... |
A bitonic program is a program every string of which is bitonic.
A bitonic string is a string S with S[0]<= . . . <=S[k]>= . . . >=S[n-1] for some k, 0<=k< n. (n is the length of the string)
Examples of Bitonic strings:
abcd
dcba
vyzcba
adgf
The goal is to write the shortest bitonic program to find the maximum of two... |
What general tips do you have for golfing in brainfuck? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to brainfuck (e.g. "remove comments" is not an answer). Please post one tip per answer.
|
What general tips do you have for golfing in MATLAB? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to MATLAB (e.g. "remove comments" is not an answer). Please post one tip per answer.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.