Code-golf is a competition to solve a particular problem in the fewest characters or bytes of source code. A competition which scores on a mixture of source length and some other criterion should be tagged [code-challenge] instead.

learn more… | top users | synonyms

-4
votes
6answers
44 views

Remove Duplicates From One List [on hold]

Task: Remove all duplicates from one list. This is a [code-golf] challenge, so shortest answer wins! You only have to remove the duplicates and present it in a form of a list. You don't have to output ...
4
votes
4answers
685 views

Maze Generation

I know there is an (old) thread similar to this (here), but I'd like to reboot it with some modifications. The goal: generate a random-looking maze using an algorithm of your choice, then output the ...
-7
votes
3answers
118 views

Challenge to generate a mathematical sequence [on hold]

I challenge you to generate the following sequence. 1 2 3 4 5 11 17 23 29 35 76 117 158 199 240 281 603 925 1247 1569 1891 2213 ......N Th term N will be only Input in your code(Any Language) ...
-2
votes
0answers
77 views

Board Game Positioning [on hold]

DESCRIPTION So you have a board, and currently the position of each place on the board, we'll say a monopoly style board to make it easy. Four sides, each with 10 unique places. That's a total of 40 ...
-3
votes
9answers
288 views

I challenge you to generate the following sequence [on hold]

I challenge you to generate the following sequence till 100 terms through any programming language in shortest characters possible. The sequence is like this :- 1 2 3 4 5 10 20 30 40 50 100 200 300 ...
13
votes
4answers
1k views

Finish lazy parentheses

The parentheses on my keyboard are all worn out, and I want to avoid using them as much as possible. Your challenge is to balance a line containing parentheses by adding them in before and after each ...
4
votes
1answer
131 views

Moving CSS rules from a CSS file to inline attributes

The goal is to take CSS rules from a regular CSS file and apply them to their respective targets in an HTML file, but by placing the rules in the style="" attribute (using the <style> tag would ...
17
votes
8answers
919 views

One Letter Swap

The largest forum on the web, called postcount++ decided to make a new forum game. In this game, the goal is to post the word, but the word has to have one letter added, removed, or changed. Your boss ...
7
votes
2answers
410 views

Gravity Controls

Your task is to find the total destination of objects that are falling to a planet, you will get inputs like this: 7 ...#... ....... #..O..# ....... ...#... ....... ....... where O is the ...
14
votes
3answers
682 views

Evolution of the 'x'

Given is a board of variable size with a maximum size of 5 times 5 fields. Every field kann be filled with an 'x'. If it is not filled with an 'x', it is filled with an 'o'. The starting state of ...
0
votes
2answers
167 views

Let us make a quine maker!

You are to create a program, that, given another program, and a position, will make it a quine. Namely, it needs to insert an expression at that point that evaluates to a string that is the programs ...
5
votes
6answers
301 views

Generate random PESEL number

From Wikipedia: PESEL is the national identification number used in Poland since 1979. It always has 11 digits, identifies just one person and cannot be changed to another one. It has ...
-3
votes
0answers
68 views

Regex to match properly formed regexes [on hold]

Create a regex that will match any properly formed regex. Shortest regex wins. Bonuses: -50% if it matches all valid regexes except itself. You will write your regex in POSIX extended. The ...
6
votes
10answers
393 views

Generate the python dictionary of phone keypresses for any letter

In the fewest bytes, generate the dictionary of keypresses for any letter (as described in https://code.google.com/codejam/contest/351101/dashboard#s=p2) In Python, the dictionary literal itself: ...
1
vote
5answers
190 views

Set Theory Operations Union Only [closed]

My obsession with set theory continues. I believe that most programming languages have neither sets as possible structures nor set theory operations such as Union and Intersection. If I am wrong then ...
2
votes
0answers
122 views

Generate ASCII art from text [closed]

Your challenge is to write a program which creates ASCII art from an input string, like FIGlet or the Unix banner utility. Specifically, your program should take as input a string consisting of ...
6
votes
0answers
387 views

Detect heartbleed exploit in the shortest amount of code [closed]

How little code do you need to detect the now infamous TLS Handshake bug? Any language goes. Brief information about the bug: The Heartbleed bug allows anyone on the Internet to read the memory ...
36
votes
60answers
11k views

Output Pi without math

In as few bytes as possible, your job is to write a program that outputs: 3.14 In celebration of a late Pi day of course! :) Rules You can do it anyway you like, but there are some restrictions. ...
13
votes
15answers
1k views

Length of String Using Set Theory

From Wikipedia Set-theoretic definition of natural numbers The set N of natural numbers is defined as the smallest set containing 0 and closed under the successor function S defined by S(n) = n ...
47
votes
37answers
7k views

My daughter's alphabet

The other day we were writing sentences with my daughter with a fridge magnet letter. While we were able to make some(I love cat), we didn't have enough letters to make the others (I love you too) due ...
-1
votes
11answers
498 views

Count the unique fractions with only integers

Count the number of unique fractions with numerators and denominators from 1 to 100, and print the counted number. Example: 2/3 = 4/6 = ... Rules: You must actually count in some way. Only integers ...
2
votes
2answers
92 views

Mex table generation [duplicate]

There is a table (the matrix one, not the one in your kitchen) called the "mex table". It has a left-top cell, at coordinates (0,0), but extends to infinity rightwards and downwards. The x-coordinate ...
-2
votes
2answers
83 views

All possible permuations in lexicographical order [duplicate]

Given a string of English alphabet characters, write the shortest code to print all possible permuations in lexicographical order without using any language based library. def function('bca'): ...
14
votes
2answers
961 views

aHHHH! The Beasts are HHHHere!

As we learned from the IBM PC AT, YouTube (see video), Wikipedia (see article), and Sesame Street: The letter H is the most merciless letter of the alphabet! (Even when actually composed from two ...
13
votes
27answers
1k views

Output the nth digits of an integer

Without using strings (except when necessary, such as with input or output) calculate the nth digit, from the left, of an integer (in base 10). Input will be given in this format: 726433 5 Output ...
14
votes
31answers
2k views

8 adjacent squares

List the coordinates of 8 squares adjacent to (0, 0) in a 2d grid. Namely, [(1,-1),(1,0),(1,1),(0,1),(-1,1),(-1,0),(-1,-1),(0,-1)] Order does not matter. The goal is to store the points into a ...
-5
votes
1answer
120 views

Shortest code to generate 2D coordinates

I'm looking for the shortest code to generate the following sequences: Sequence A i | y x 0 | 0 0 1 | 0 1 2 | 1 0 3 | 1 1 The best I have is x = i % 2, y = i / 2, there is probably no beating that. ...
7
votes
20answers
784 views

Merge two sorted lists

Merge Sort In this challenge, you will implement the merge subroutine of merge sort. Specifically, you must create a function or program or verb or similar which takes two lists, each sorted in ...
10
votes
7answers
2k views

Determine if a number is prime without using arithmetic [duplicate]

Write a program which determines if a given number is prime. The catch: No digits or arithmetical operators. This means: No digits from 0 to 9, anywhere in the program, and whatever the meaning No ...
19
votes
3answers
752 views

Hiding information in Cats

You are a secret agent trying to communicate with your fatherland. Of course the information needs to be hidden so no one eaves drops your message. What would be better suited than a cat? Everyone ...
17
votes
11answers
2k views

Roll Dungeons and Dragons dice

I want to play Dungeons and Dragons, but I don't have any dice! Your challenge is to roll some D&D dice. The input format specification in Backus-Naur form is: <valid-input> ::= ...
9
votes
2answers
407 views

Regex in reverse - decompose regular expressions

The Problem I have a bunch of regular expressions that I need to use in some code, but I'm using a programming language that doesn't support regex! Luckily, I know that the test string will have a ...
-6
votes
5answers
167 views

Multidimensional array

This is a code-golf, so keep your code small! The objective is to create a function that receives 3 arguments: Rows(int): The max number of an item in each array; Cols(int): The max number of ...
8
votes
1answer
384 views

Which is better - Emacs or Vim? (Google fight)

noble code golfers. Today you will resolve the most ancient and distinguished of debates - Emacs or Vim? Your challenge is to take two search terms as input, and output which of those terms has the ...
15
votes
6answers
1k views

Predict where the man will go

A man lives in the north-west corner (0, 0) of a town with height h and width w . Everyday he walks from his home to the border (?, w) or (h, ?). In the following example, the man goes to (3, 3) ...
12
votes
14answers
2k views

Remove a letter to make a palindrome

Problem Let's say that a word is almost a palindrome if it is possible to remove one of its letters so that the word becomes a palindrome. Your task is to write a program that for a given word ...
26
votes
16answers
3k views

Dwarves and Coins

The Situation: Several (M) dwarves have found a goblin's chest with N gold coins and have to divide them. Due to ancient rules governing the allocation of loot to pirates in order of seniority, the ...
13
votes
6answers
680 views

If community would have been a person

Well the community is just a bot. But what if it would have been a person? Your task is to find what community's reputation might have been if it would have been given reputation for the edits it ...
3
votes
0answers
154 views

Hack Sequence : Simplify Hi = 2014*Hi-1 + 69*Hi-2 [closed]

Can someone help me with simplifying this sequence. I write code to loop through entire n, I am getting timeout. Hack sequence of IndiaHacks-2014 if given as below Hi = 2014*Hi-1 + 69*Hi-2 for (i > ...
13
votes
18answers
2k views

Anonymize names - sort of

Edit: There will be a bonus of -20 for random masking Hello fellow Whistleblowers and carriers of secret knowledge. I am due to an interview by mail and I - of course - cannot say specific names in ...
3
votes
1answer
413 views

Unicorn “Miner” CodeGolf [closed]

This is a pretty cool CodeGolf challenge in the sense that you're only going to have a limited amount of time to do it. You need to build a program that "mines" StackOverflow unicoins. In order to do ...
6
votes
2answers
365 views

Confuse the Word spell checker!

Your task is to make a program that will take an input of a word of any length, in the Calibri font. This word will be made out of characters that are found on a normal QWERTY keyboard. There will be ...
27
votes
17answers
5k views

How much bounty is out on Stackoverflow?

Task: You are an amazing programmer and Stackoverflow-answerer, and you decide to answer every question with a bounty on Stackoverflow. You are so good, that you manage to get all the bounties in all ...
15
votes
1answer
519 views

Android Lock Screen

Intro You are sitting in a board room at the end of a long table. You look around and see Tim Cook, the Apple Board of Directors, the ghost of Steve Jobs, and Jack Donaghy. Apple has called this ...
-3
votes
0answers
79 views

Shortest code for Factorial in C\C++ [duplicate]

This contest is language specific Write the shortest program in C\C++ that will take in a number and print its factorial. The factorial is found by multiplying a number by each of the digits that ...
19
votes
1answer
427 views

Protect my walls from these pesky doors

Doorknobs are great and all, but when you open a door, it always dents the walls around it. I need you to take input of ASCII art of a room, like this: +---------+--X --X --+-----+ | \ ...
10
votes
4answers
479 views

Compare two poker hands

Challenge: Given two five-card hands, determine which one wins by the standard ranking of poker hands. Input: Ten cards separated by spaces from stdin or as command line arguments, whichever you ...
9
votes
11answers
959 views

Calculate your stack exchange reputation

Background: I often find that, when browsing a Stackexchange site, I begin to wonder how people get the amount of reputation that they have. I know I can always count on codegolf SE to solve my ...
-6
votes
2answers
85 views

Shortest code for a codegolf-style character counter without using bash [closed]

You have to write a program that will count all the characters in specified source file so that people entering a code golf competition can see their score. You do not need to ignore comments (it is ...
15
votes
4answers
465 views

I like Pythagorean trees

...so this is a challenge to make me a tree. Produce a program or function called tree which takes a single integer argument, N and draws a Pythagorean Tree N levels deep, where level 0 is just the ...