instruction stringlengths 34 53.1k |
|---|
Given an arbitrary array of octets, and an offset measured in bits, the goal is to bitwise left rotate the array by the specified number of bit positions as if the entire array were a single contiguous number. Byte order is big-endian.
As an example, given the (not zero terminated) ASCII string abcd and a shift of 5 bi... |
Given an array (N) of integers, check if it is possible to obtain a sum of S, by choosing some (or none) elements of the array and adding them.
Example #1
{1,2,3}
4
should output
1 (or true)
because 1 and 3 can be added to produce 4.
Example #2
{3,6,2}
0
should output
1 (or true)
because adding none of them togethe... |
Find the shortest regex that matches all radioactive elements and nothing else in the Periodic Table of Elements.
Radioactive Elements
'Technetium','Promethium','Polonium','Astatine','Radon','Francium','Radium','Actinium','Thorium','Protactinium','Uranium','Neptunium','Plutonium','Americium','Curium','Berkelium','Calif... |
Rules:
Your program can be in any programming language.
Your program should not take any input.
Your program should transform the word "RELATIVE" into "STATIC". The word can at any stage only consist of uppercase letters A-Z.
Your program can only use 8 different operations.
The length, in number of letters, of the w... |
Find the shortest regex that matches all non-radioactive elements and nothing else in the Periodic Table of Elements. This is the inverse of Regex for Finding Radioactive Elements
Radioactive Elements
'Technetium','Promethium','Polonium','Astatine','Radon','Francium','Radium','Actinium','Thorium','Protactinium','Uraniu... |
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 printed number will be divided by the cube of the number of bytes you used for your solution.
So, let's say you printed ... |
This question involves taking input in Morse code as . (period) and - (minus symbol), with spaces to separate the input. Your task is to convert the code to standard output. You can assume that the only input contains character symbols found in the International Morse Code alphabet, found here: http://en.wikipedia.or... |
Write a program that takes a brainfuck program and compiles it to executable machine code. You can target x86, x86_64, jvm (java bytecode) or armv6, and use one of the following executable formats: ELF, a.out, class file, exe, com. The executable should work in Linux or Windows (or Java on either).
Neither your program... |
Forgetting quotes can lead to certain problems.
For example, in Scala the two expressions:
"("+("+")+(")+(")+")"
("+("+")+(")+(")+")
differ only in starting and ending quotes, but they respectively yield the result:
(+)+()
+()+()+
But this expression in scala almost has the desired property:
def m="+m+"
""+m+""
You... |
Although there was a hangman competition before, I don't feel it was beautiful enough. The challenge is to implement a clone of http://inventwithpython.com/chapter9.html but as in the previous competition you can input the list of words in any way you want. The main difference is therefore just that you have to draw ... |
Can you write an aphorism in at most 4 lines of code ?
Code should read as much as possible as an aphorism in plain English and should return the boolean true.
Language: of choice.
Criteria for accepted answer: Most votes in 180 30 days. (8th of July 2014)
Originality: can be an old aphorism but a creative one would ... |
For a given n, count the total number of zeros in the decimal representation of the positive integers less than or equal to n. For instance, there are 11 zeros in the decimal representations of the numbers less than or equal to 100, in the numbers 10, 20, 30, 40, 50, 60, 70, 80, 90, and twice in the number 100. Expect ... |
Today, Numberphile posted this video where it's stated that 1+2+3+4+...+n = -1/12.
While this isn't really new (several ways to prove that have been found, you can look here for further informations), this leads us to our question!
Your goal is to write a function that returns -0.083333 (feel free to stop at -0.083 if ... |
You're tasked with writing two programs. Program A must print out nothing on all inputs except when program B is input, in which case it should print 1. Program B must print out 1 on all inputs except when program A is input, in which case it should print nothing.
Scoring:
+1 For each character from both programs.
Lo... |
Seeing as there have been an awful lot of normal Fibonacci challenges, I decided that it might be interesting to calculate the Reciprocal Fibonacci constant - namely, the sum of the reciprocals of the Fibonacci sequence.
The challenge is to calculate the Reciprocal Fibonacci constant with the number of Fibonacci series... |
Most of you have probably heard of the famous Turtle Graphics program, initially made popular by Logo. This challenge is to implement a Turtle Graphics program in your language of choice.
Rules:
Rule one is that when the pen is in the down state, it must draw in both the square the turtle leaves and the square the tu... |
This is a code golf puzzle with a real-world application. Some current browsers, if you enter a URL that looks like
data:text/html,<script>alert("hi")</script>
will execute the given JavaScript code. Now suppose you had a URL which looked like (pseudocode):
data:text/html,<script>
myPublicKey="12345678";
crypt... |
Is it possible to write a C program that multiplies two numbers without using the multiplication and addition operators?
I found this on Stack Overflow. Please help this poor programmer with his problem. And please don't give answers like c = a/(1/((float)b)), which is exactly the same as c = a*b. (And is already giv... |
I happened to glance at my watch today at exactly 11:11:11 (and today is 1/11; too bad it's not 2011), and that got me thinking: I know! I should make a code golf question out of this! I'm a dork.
Anyway, your challenge is to take an hour, minute, and second as input, and output the next "interesting" time. Here, I wil... |
Given a list of pairwise distinct integers, sort it in alternating order: The second number is larger than the first, the third is smaller than the second, the fourth is larger than the third etc. (This order is not unique.) E.g., 5 7 3 4 2 9 1 would be valid output.
Extra points (since this is code golf, subtract from... |
I'm creating a simple challenge here as a first test of the community's reactions. Please let me know if this challenge is the kind of thing you guys like or what I can improve... :)
The task is this: Render a chess board in Lua in smallest code possible.
Here is an example solution: http://tinybrain.de/145
As you can ... |
This is the target language-relaxed version of Generate a self-extractor application
Create a program in any language, that takes an arbitrary binary input, and generates a valid program (also in any language), which when compiled and run (or interpreted) will print this binary input.
So you could do this:
$ cat file.d... |
Copy and paste or curl this text:
http://lorem-ipsum.me/api/text
Using any language make the text palindromic.
You may remove letters.
You may rearrange letters.
The goal is to make the text palindromic by the sequence of the letters and spaces. The end result might not contain words. It will be merely a sequence o... |
Just a simple code golf function for fun, intentionally left open with few rules to see what creativity comes up.
Input: An integer representing the area of a rectangle.
Output: Two integers representing the side lengths of the rectangle that have the least perimeter for the area. (In any order.)
Test cases:
25 => 5, ... |
Your mission is to write the shortest valid regular expression that no string can match, empty string included.
Submissions must have this form ("literal notation"):
/pattern/optional-flags
Shortest regexp wins. The regexp size is counted in characters. (including slashes and flags)
Please explain how your regexp work... |
General constraints:
Your program should not take any input.
Your program should output words, 1 word/line.
Only capital letters (A-Z) in the output.
A word must be atleast 2 letters in length.
A word can never be a palindrome. That is forbidden.
Rules for word-manipulations, one or more of these operations in any in... |
Let a function receive two integers i and j between 0 and 3, it should return the value in position (i,j) in the following 2D array:
1, 0, -1, 0
1, 0, -1, 0
0, 1, 0, -1
0, -1, 0, 1
Shortest code in any variant of C / C++ wins.
|
bool doYouFeelLuckyPunk, actuallyIsLucky;
doYouFeelLuckyPunk = Harry.catchyPhrase();
actuallyIsLucky = Bandit.rollDice();
if(doYouFeelLuckyPunk) {
Bandit.grabGun();
if(!actuallyIsLucky)
Harry.useMagnum()
else {
Harry.tisButAScratch()
}
else
Bandit.surrender();
We all know how this p... |
Here's an interesting problem I thought of the other day, which involves bits of code competing against other bits of code not just in a property that the code has, but by playing a game against those other bits of code.
Your task is to build a program that takes the current state of a Go board, and determines what mov... |
This will be my very first post on stackexchange so bear with me.
Create a program that counts from 0 to 1,000,000,000.
Now the trick is to not print all these characters but to only print how many zeroes are in that number. And keep track of the total amount of zeroes you've encountered. For example
10
Will output;
1... |
Your task is to create a program that computes every combination of the operations written in a .TXT file.
Example TXT File:
1
+
2
/
3
Example Output:
1+2/3=1
1+3/2=2
2+1/3=1
2+3/1=5
3+2/1=5
3+1/2=2
1/2+3= //See bonuses. If your program does not feature float, leave blank result.
1/3+2= //See above.
2/1+3=5
2/3+1= //S... |
I would like to propose a new kind of challenge: Anti Code Golf! (as anti-golf, not anti-code). The idea is to write the longest program you can write to do something.
That would be Code Bowling, as pointed out by ProgramFOX.
Rules
No ridiculously unnecessary whitespace (e.g. 3 lines between each statement, etc. inden... |
Challenge
The goal of this challenge is to take a radical and convert it to a reduced and entire radical, and a real number. You do not have to convert it to all 3, however, you will get bonus points for converting it to 2 or 3 of them. You will also get bonus points if your code works not just with square roots. How t... |
Write a function which takes a single positive integer n and returns the period of the decimal representation of 1/n.
Test cases:
1 -> 1 # 1/1 = 1.0000...... = 1._0
2 -> 1 # 1/2 = 0.5000...... = 0.5_0
3 -> 1 # 1/3 = 0.3333...... = 0._3
7 -> 6 # 1/7 = 0.14285714.. ... |
In this challenge, your task is to take an simple recording in mp3 format and find the time offsets of the beats in the file. Two example recordings are here:
https://dl.dropboxusercontent.com/u/24197429/beats.mp3
https://dl.dropboxusercontent.com/u/24197429/beats2.mp3
Here is the third recording with much more noise t... |
Create a program or function to unjumble a square of digits by flipping (reversing around the centre point) only rows and columns.
Input
Input will be a 9x9 grid of digits in the form of a 9 line string like the following:
986553229
264564891
759176443
643982153
567891234
526917874
685328912
891732537
117644378
This i... |
This challenge is to write a program or script which counts the sum of all digits within the integers from 1 up to and including a given number.
Input, one positive integer.
Output, the sum of digits in that number and all smaller numbers.
Examples:
Input: 5
Integer Sequence: 1, 2, 3, 4, 5
Sum of Digits: 1 + 2 + 3 + 4... |
In fairness, this is based on a StackExchange question - but its a good question.
The challenge is fairly simple:
Take a string of numerals
Find and print the largest contiguous prime number in the string
Scoring:
Lowest number of characters wins.
Victor will likely be a golfscript entry but we won't hold that again... |
My parents-in-law have a fishpond in their yard, filled with koi. It didn't really cross my mind until I noticed the following extract from my code.
',') & '_'
... I had fish-faces looking back at me from my screen...
Which has given me a great idea...
My quest for you, my dear golfers is to create a one-line ASCII aqu... |
Given a unique, sorted list of integers, create a balanced binary-search tree represented as an array without using recursion.
For example:
func( [1,2,3,5,8,13,21] ) => [5,2,13,1,3,8,21]
Before we start, a hint: we can simplify this problem a ton so that we don't actually have to think about the input integers (or any... |
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000001111111111111100000000000000000011111111111111100000000000000000
000000111111111111110000000000000000... |
Print a continuous sinusoidal wave scrolling vertically on a terminal. The program should not terminate and should continuously scroll down the wave (except until it is somehow interrupted). You may assume overflow is not a problem (i.e. you may use infinite loops with incrementing counters, or infinite recursion).
The... |
Okay, the challenge is that you have to write a regex that matches half of all strings.
Some rules to clarify:
For ANY string length(>0), if I permute all strings(of that length), exactly half of them should be matched. Put more lightly, if I generate a random string of that length it should have a 50% chance of being ... |
Nepal’s flag (Wikipedia, Numberphile) looks very different from any other. It also has specific drawing instructions (included in the Wikipedia article). I want you guys to make a program which will draw the flag of Nepal.
The user inputs the requested height of the flag (from 100 to 10000 pixels) and the program outpu... |
As many geeks may know most pages (95% i think) on wikipedia eventually lead to Philosophy like this:
Click on the first non-italic or in parentheses link that is to another normal article: (i.e. not File: or Special:, but things like Wikipedia: are OK) and repeat on that one until you hit philosophy.
The script must:
... |
Here is a list of 30 English nouns in their singular and plural form. Your job is simply to write the shortest regular expression that matches all the nouns in one form and none in the other (easy, all English nouns end in s in plural form right?).
SINGULAR PLURAL
--------- --------
car cars
boat ... |
Given two arbitrary integers \$a\$ and \$b\$, count how many numbers are divisible by perfect numbers in that given range (\$a\$ and \$b\$ both are inclusive).
In mathematics, a perfect number is a positive integer that is the sum
of its proper positive divisors, that is, the sum of the positive
divisors excluding the... |
The number 1 can be written as sum of fractions of the form 1/p (where p>1). There are different ways to write it. You will be given an integer k which denotes the number of fractions to be used to get the sum as 1. You need to find the largest possible value of p among all possible ways. See sample input for clarity
I... |
In a language of your choice, write a program that exactly outputs the characters Hello world! followed by a newline. The code:
should not use any character more than twice (alphanumeric, symbol, whitespace...anything)
should not use any external resources
should not use any user input
should not output anything else... |
You need to make three things:
Statement of a task, T.
Solution of the task in language not typically used for golfing, A.
Solution of the task in language typically used for golfing, B. Don't try to just bloat up B to pump up the score, instead think as if B was written by your competitor.
Use common sense in defini... |
What I would like to see is a fractal tree being drawn where the you can input an integer, and the output will be a fractal tree with the entered amount of branch steps.
Rules:
The fractal should be a line fractal tree:
the shape of the fractal should also be the same as this picture.
Each branch should decrease by 2... |
Your program should output exactly: Hello world!!! with or without linefeed after.
Your program should take no input.
Sourcecode character distribution must be correct according to:
The number of numeric characters (0-9) must be exactly one fibonacci sequence number.
The number of other non-numeric characters !(0-9)... |
Your program should take no input, and no network or other connections.
Your program should output it's sourcecode.
The sourcecode must consist of 3 types of characters: Numeric (0-9), Alpha (a-z|A-Z) and symbols !(0-9|a-z|A-Z). Constraints for the distribution of characters is:
3.1. Every neighbouring characters wit... |
Objective:
Write one program that outputs sourcecode for another program that outputs words.
General information:
Any programming language.
Rules:
Your programs should not take any input. (from user, filename, network or anything).
The generated program sourcecode must not be in the same programming language as th... |
In this challenge, your job is to write a program that allows a user to enter an integer. Then, the program must find all the possible ways of multiplying two numbers to get the user's integer.
Rules:
The program should not show any problem more than once.
The user should be able to enter any integer.
The program shou... |
So, you were sitting at your desk, golfing a program to calculate the first 20 digits of pi, and along comes your boss and throws your apple IIe out the window. You are now working on a new project and this computer does not yet have any text capability. None. No fonts. Nothing.
Now let's finish that program. Calculate... |
Related: Hello world!!! Fibonacci distribution
Create a program that returns True if a given input meets the following specifications, and False otherwise:
The count of numeric characters (0-9) in the input matches a Fibonacci number.
The count of non-numeric characters !(0-9) in the input matches the Fibonacci numb... |
Your sourcecode must not contain any of the characters it outputs (case sensitive).
Your program must not output more than 500 characters/bytes. 1 byte = 1 char. Newline counts as 1 character.
Your program should not take any input. (from user, filename, network or anything).
Your program must output words/phrases wor... |
Your program must output atleast half of its sourcecode in reverse. Any single part of the sourcecode as long as it is one single block of neighbouring characters.
Your program should not take any input (from user, filename, network or anything).
The output has some additional constraints. The character position (fir... |
This challenge is about finding the perfect match between your program sourcecode and the output from your program.
Scoring table for the output:
Each letters (a-z|A-Z) :
`a` or `A` 1 points
`b` or `B` 2 points
...
`z` or `Z` 26 points
Scoring for the sourcecode:
... |
Terms
A worm is any list of nonnegative integers, and its rightmost (i.e., last) element is called the head. If the head is not 0, the worm has an active segment consisting of the longest contiguous block of elements that includes the head and has all of its elements at least as large as the head. The reduced active se... |
Objective:
This code-golf is about creating 2 different sourcecodes that both outputs exactly: Hello, new world! again. without linefeed, and when combining the two sourcecodes into one sourcecode it should still output exactly: Hello, new world! again.
Rules:
Your programs should take no input (from user, filename,... |
For this challenge, write program A that when given no input, prints the code for A (a quine), but when given input, the output will be modified. The input for A will be 0 or more statements in whichever language A is programmed. The output of A will be the code for program B which runs the input to A and then does t... |
The goal of a rosetta-stone challenge is to write solutions in as many languages as possible. Show off your programming multilingualism!
In this challenge, you will create a program that will generate spam messages, given an input seed-text. For example, given the input
[Thank you/Wow/Great], this [blog/post/writing] [... |
In any programming language that existed before this question was asked, write a program (not a function) that outputs the characters Hello world! followed by a newline. Your program:
should not use any character more than once (including whitespace)
should only use ASCII characters
should not use any built-in librari... |
Your task this time is to implement a variant of the POSIX expand(1) utility which expands tabs to spaces.
Your program is to take a tabstop specification and then read input on standard in and replace tab characters in the input with the appropriate amount of spaces to reach the next tabstop. The result should be wri... |
Objective:
The task is to create two programs using the same or different
programming languages. The sourcecodes will be combined in two
different ways and the resulting sourcecodes can be in any programming
languages. The four programs (original two + the two combinations)
should output different things.
Rul... |
Objective: Write a program that generates beautiful (?) ASCII-art landscapes and skylines!
Your program has just one input: a string composed of any combination/repetition of the chars 0123456789abc.
For each input character, output a vertical line composed as follows:
.
..
...
oooo
o... |
A simple Manufactoria challenge. Compute the input modulo 7. The input will be in big-endian binary (blue=1, red=0). The output should be in the same format.
Test cases provided. The smallest part count wins.
http://pleasingfungus.com/Manufactoria/?ctm=Mod7;Input:_binary_number_big_endian._Output:_that_binary_numbe... |
There's a question with a comment with some code thats far too long.
For a site that has counting fetish, this code just seems so wrong.
Solve this meta-riddle, and explain it with a rhyme.
Winner is the shortest code in a fortnights time.
The challenge:
Open a file as input.
Count and output the number of digits (0... |
Challenge
Draw the Olympic Games logo...
...as character (e.g. ASCII) art!
Sample Output
* * * * * * * * *
* * * * * *
* * * * * *
* * * * * * * *
* ... |
In your language of choice, write a program that outputs exactly Hello world!. Each character in your program must be repeated n times - you choose n.
For example, you might choose 2 for n. This means that every character used in your source code must be repeated that many times, or 0.
If I were to choose 3 for n, thi... |
Given that the Chinese New Year is coming, here is a challenge to calculate the Chinese Zodiac, element and Taijitu for a given date.
The input should be a date:
1/31/2014
The date used here is the US style mm/dd/yyyy, but may alternatively be ISO-8601 style: yyyy-mm-dd so the style of date input is not strict.
The ... |
In a similar spirit as this question, your mission is to create the best-looking logo in at most 1K of code.
Rules:
At most 1K of code (inclusive), no external data.
The answer with the most upvotes wins.
Have fun!
|
Write a program that takes a string and outputs all the characters in alphabetical order.
Spaces and symbols can be ignored or deleted, but the upper- and lowercase letters must remain the same case.
Sample input:
Johnny walked the dog to the park.
Sample output
aaddeeeghhhJklnnoooprtttwy
Rules:
• Any language
• Shor... |
The code should take a string as input from keyboard:
The definition of insanity is quoting the same phrase again and again and not expect despair.
The output should be like this(not sorted in any particular order):
: 15
. : 1
T : 1
a : 10
c : 1
e : 8
d : 4
g : 3
f : 2
i : 10
h : 3
m : 1
o : 4
n : 10
... |
Insanity: doing the same thing over and over again and expecting different results.
Write a program that just throws an exception (runtime error) each time it is run. The challenge being to have the probability to produce more than one crash, without calling the exceptions directly (no throw statements) and not to us... |
Challenge
Draw a Heart shape
...as ASCII art!
Your art doesn't have to look exactly like mine, but it has to look like a Heart Shape.
The inside of of the heart has to contain the words "Love" at least 20 times
Rules
The program must write the art to the console.
Shortest code (in bytes, any language) wins.
The winn... |
Your challenge, should you be coded to accept it, runs as follows:
You may choose one of the following two challenges to implement:
Challenge #1
Read from a file a.txt
Write only printable ASCII characters (values 32-126) to a file b.txt
Challenge #2
With a file a.txt, delete all characters in the file except printa... |
The Code
Your program should take an input of n > 2 and output the largest prime less than or equal to n. You can choose how the number is input (standard input, read from a file, etc). For example:
Input Output
3 3
9 7
28 23
486 479
Simple enough. And if a program passes all of the test cases it's g... |
Challenge:
Write a program that outputs a graphic file 1920 pixels wide by 1080 pixels high. Every one of the 2,073,600 pixels within the graphic must be a unique colour and no colour values should be repeated. The colours should be specified in RGB and start at 0,0,0 and count upwards in sequence towards 255,255,255. ... |
Build an interpreter for a fake, stack-based language that gets an input, interprets it, and outputs the result as an array of numbers. It should iterate through each byte and perform a different function based on this table:
0000 (0):
Concatenate (Combine top two numbers in a stack as if they were a string. ex: 12,5 -... |
9-hole mini-golf: Description
9 (mostly fairly easy) code golfing challenges of varying difficulty
Penalties for using the same language more than once
All challenges about a specific theme (this theme: Text Manipulation)
Input and output can be anywhere reasonable (i.e. STDIN and STDOUT, reading from/writing to a fil... |
Input must not be required, and output must read "All your base are belong to us".
Restrictions
No external resources.
Plus a minimum of two of the following:
You cannot use "a", "b", "t", "u", or "y" in any case in your code (bonus -10 to your golf score if you can do this)
You cannot use "l", "o", "s", "e", or "r"... |
This is a challenge on the internet asked by Palantir Technologies in their interviews.
A group of farmers has some elevation data, and we’re going to help
them understand how rainfall flows over their farmland. We’ll
represent the land as a two-dimensional array of altitudes and use the
following model, based ... |
Given two arbitrary numbers A,B. Print number B as a Digital LED Pattern where A is the scale.
input:
1 2320451640799518
ouput:
_ _ _ _ _ _ _ _ _ _ _ _
_| _| _|| ||_||_ ||_ |_|| | ||_||_||_ ||_|
|_ _||_ |_| | _| ||_| ||_| | | | _| ||_|
input:
2 23
ouput:
__ __
| |
__| ... |
Can you render out a version of the BBC Micro Owl logo as per above from code?
Rules:
You can use any programming language you like.
Output can be text or graphic.
Circles don't have to overlap.
Winner:
The answer with the most upvotes wins.
Kudos for anyone that attempts this in BBC basic.
You can read about the... |
The biggest program that reads a single line (terminated by your choice from NULL/CR/LF/CRLF) from stdin, reverses it, then prints it to stdout.
No redundant code [code which could safely be deleted] such as
return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
or redundant data that's used to stop code... |
In the spirit of Hello world! with NO repetition
Write a program that prints the string "the quick brown fox jumps over the lazy dog" with optional newline. The entire program must not repeat any characters.
Note that the string to be printed does repeat characters, so you will have to get around that limitation someho... |
What general tips do you have for golfing in Haskell? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Haskell. Please post only one tip per answer.
If you are new to golfing in Haskell, please have a look at the Guide to Golfing Rules in Haskell. There... |
Within the scope of this question, let us consider only strings which consist of the character x repeated arbitrary number of times.
For example:
<empty>
x
xx
xxxxxxxxxxxxxxxx
(Well, actually it doesn't have to be x - any character is fine as long as the whole string only has 1 type of character)
Write a regex in any ... |
What I'd like to see is your attempts at writing a kind of "story" that has a fairly easy to read meaning, but also creating a valid code fragment. For example, this (BBC) BASIC code:
LET customer = "sober"
REPEAT
INPUT "more beer"
UNTIL customer = "drunk"
(based on http://img.rakuten.com/PIC/12184048/0/1/300/121840... |
Given an array of 32-bit integers which represent a bit array, shift the values by a specified amount in either direction. Positive shifts go to the left and negative values go to the right. This is a bit array so bits should wrap across values in the array.
For example, given the following data:
a[2] = 11110000 111100... |
If a compiled language is used, the program must delete the compiled executable (but need not delete the source file). If an interpreted language is used, the program must delete the source file.
My opening bid:
Python (29 characters)
import os;os.remove(__file__)
Edit: to prevent solutions like rm -rf /, the program ... |
Write some program (the size doesn't matter), and put a line that looks useless, but it's actually not - if it would be removed, the program would crash, or do something wrong. Feel free to mark the line that looks unused by a comment, or mention it your code description, like in example below (of course, in this examp... |
Problem: Remove characters from strings to make the longest (character length) palindrome possible. The first line gives an integer value of the number of strings to test. Each subsequent line is a string to test.
Example Input:
3 // Number of lines to test
GGABZXVYCCDBA
ABGBAD
ABC
Example Output:
ABCCBA
ABGBA
B
Shor... |
The challenge is to come up with a mathematical way to generate each character of the exact string:
Hello, world!
(Capital letter, comma, exclamation mark.)
But you can't use any strings, arrays, or equivalents, to contain the data of the text. You must derive the characters by mathematical means.
So just a list or a... |
Write an algorithm or program that can encode and decode a chess board. The goal is to make the smallest representation of a chessboard that could be used (once decoded) to determine all movement possibilities for a player on that turn.
The encoding must be able to show:
Whose turn it is.
Whether the player can castle... |
Your challenge today is to take input like this:
fbcfbee
ffcabbe
debceec
bccabbe
edcfbcd
daeaafc
eebcbeb
And output the best possible move in a Bejeweled-like game that will match three or more letters, like this (note the capital B and C):
fbcfbee
ffcabbe
deBCeec
bccabbe
edcfbcd
daeaafc
eebcbeb
Full specifications:
... |
What general tips do you have for golfing in Io? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Io (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.