All Questions
-3
votes
0answers
55 views
Adding a list of numbers NOT using + [duplicate]
Task:
Longest code to add a list of numbers without using the + operators.
Rules:
1. No variables that you will not use in the code.
2. No brute force. Example:
#not allowed
if len(x) == 2:
if ...
13
votes
4answers
624 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 ...
16
votes
1answer
194 views
Hunger Gaming - Eat or Die
Hunger Gaming - Eat or Die
If you don't eat, you die. If you eat, you live (until you die). You will die, so try to die last.
Overview
There is an island populated with a herd of prey animals. You ...
6
votes
2answers
294 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 ...
-2
votes
0answers
110 views
Parameter passing exercise [on hold]
Task
Write a program that behaves differently according to how the compiler approaches parameter passing. Treat these cases as imaginary: "if I had a compilator that passes by reference" or "if the ...
12
votes
2answers
444 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
150 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
5answers
265 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 ...
9
votes
0answers
194 views
King of the Hill: Speed Clue AI
This is my first time authoring a programming challenge. If other people enjoy this, I might take a crack at some more. I hope the problem description is not too long...
Goal
Your goal is to ...
1
vote
1answer
91 views
HQ9+ Interpreter or Quine? [duplicate]
Write an interpreter for HQ9+ in your favourite programming language with the following quirk: If the input to the interpreter is empty or not a valid HQ9+ program (i.e. contains other characters than ...
-3
votes
0answers
65 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
384 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 [on hold]
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
110 views
Generate ASCII art from text [on hold]
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
367 views
Detect heartbleed exploit in the shortest amount of code [on hold]
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 ...
33
votes
56answers
8k 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.
...
12
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 ...
46
votes
36answers
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
496 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
91 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 ...
-5
votes
0answers
83 views
Tom and friends - trains [closed]
To train station arrived trains to say goodbye to their friend Tom, which was going on a rent after long working. For this occasion Tom's friend organized fun in which one all trains have taken a ...
-2
votes
2answers
81 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'):
...
13
votes
2answers
929 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 ...
21
votes
6answers
664 views
+100
Hangman solver king-of-the-hill
You are required to write a Hangman solver. Testing against this English word list[1], the solver that solves the most number of words wins, with the number of total incorrect guesses being the ...
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 ...
10
votes
3answers
172 views
Build a bit-counting comparator using NAND logic gates
A bit-counting comparator (BCC) is a logic circuit that takes some number of counting inputs A1, A2, A3, ..., An as well as inputs B1, B2, B4, B8, ... representing a number. It then returns 1 if the ...
-5
votes
1answer
118 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
776 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
744 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
400 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 ...
148
votes
49answers
15k views
Survival Game - Create Your Wolf
The Board
The Board is a two dimensional array of cells. Cells are populated by Animals. Every day, all Animals on the Board simultaneously make one move. If two or more Animals move to the same ...
11
votes
4answers
1k views
Shortest code to write longest code
Your challenge is to create a shortest code in your language of choice which writes on a .txt file the longest code to multiply two numbers by taking two numbers as input and output the answer.
NO ...
-6
votes
5answers
157 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
381 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 ...
-4
votes
1answer
114 views
Longest code to reduce words [closed]
Write a code in your favorite language which reduces words To first three characters.
Input : One word
Output : First three letters
For example
INPUT : ProGramming
OUTPUT : Pro
INPUT : ...
13
votes
6answers
666 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
153 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 ...
13
votes
2answers
587 views
Lets take Beal's $1,000,000
Beal's Conjecture has a million dollar prize if you prove/disprove it.
It states that if where A, B, C, x, y, and z are positive integers with x, y, z > 2, then A, B, and C have a common prime ...
14
votes
2answers
697 views
2048 king on the hill
We have been cloning 2048, analyzing 2048, but why haven't we played it yet? Write a 555 byte javascript snippet to play 2048 automatically, the best score after an hour will count (see scoring ...
25
votes
29answers
4k views
Convert short month names to their longer counterparts [Ended]
This challenge has ended! Congratulations Flonk!
I was sure I would get a good grade, but after turning in Flonk's my work, my professor did not believe it was mine and also could not understand why ...
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 ...
12
votes
1answer
612 views
+150
Juggling by Numbers
Your task is to generate a valid juggling pattern by completing a given template. But first, you probably need to know how such a pattern is denoted.
Introduction to Siteswap
Siteswap is the ...