All Questions
-4
votes
3answers
67 views
Creating a Code Golf challenge such that you are sure to win
Your friend Tiger, a renowned golf expert, thinks he is so much better than you, he issues the following challenge:
Name any language L you like from a list he gives
Give any output string s
If his ...
14
votes
3answers
229 views
Has my milk expired?
Aww, man, this expiry date doesn't write the months with letters! I can't tell if it's expiring on March 10th or October 3rd... Wait, no, never mind, the year says 2012. (alley-oops half-used brick of ...
2
votes
1answer
110 views
Brainfuck Sorting
Write a program in brainfuck that accepts input of 4 ASCII characters as numbers (from 32 to 126) and outputs the numbers or ASCII equivalent sorted in ascending order.
Requirements: Your program ...
0
votes
0answers
42 views
Obfuscating cryptographic key in Android [on hold]
First, I realize this may be off-topic here because
It's not a golf question
It has a practical use
so I'll understand if it's closed, but figured I would try.
I need to generate and ...
-4
votes
0answers
31 views
i need a program to initialize an array of five names and initialize another array with their respective telephone numbers [on hold]
search for a name input by users , in the list if found, display "search successful and print the name along with the telephone numbers" otherwise display "unsuccessful name not enlisted"
4
votes
1answer
129 views
Golfed sort by debian version number
I wrote some perl to sort by debian package version number (specification here). Whilst readable, it was disappointingly long (114 lines, 2042 characters) - shocking. So this challenge is to produce ...
0
votes
0answers
34 views
Check if the input can be valid UTF-8 in minimal Unicode graphemes [on hold]
Write source or machine code that reads some input (stdin or file or argv) and outputs (prints messages, returns exit code) if it can be valid UTF-8 (private and not-yet-defined codepoints are ...
7
votes
4answers
187 views
Reduce html to n characters while keeping the formatting
Almost every language has a built-in function that can split a string at a given position. However, as soon as you have html tags in the string, the built-in function will not work properly.
Your ...
5
votes
8answers
280 views
Make a finky syntax checker
You are to make a program that can check the syntax of programs of its same language. For example, if you do it in python, it checks python syntax. Your program will receive a program on standard ...
14
votes
14answers
1k views
Golfing ASCII-art
Let's try to golf this piece of ascii-art representing a golfing man:
'\ . . |>18>>
\ . ' . |
...
8
votes
28answers
917 views
Randomly pick one number that is different than two other random numbers
Two random numbers A and B have been generated to be either 1, 2, or 3
your job is to randomly pick a third number C that can also be 1,2 or 3. But, C cannot equal A or B.
And Yes, A can equal B.
...
13
votes
8answers
705 views
Translate ASCII text to braille
Write a program that translates ASCII text to braille output. Requirements:
Input may come from stdin, command line, or some other external input source.
Output should be recognisable as braille, ...
-1
votes
1answer
93 views
Noscript Scripting [on hold]
As we all know, a significant number of website users for some strange reason don't have JS. Therefore, What is the most interesting thing you can do using only CSS3 and HTML5?
For example, can you ...
0
votes
0answers
37 views
Product of corresponding elements in 2 arrays [on hold]
Given two arrays suppose A and B, of length N and length k respectively.
If we move B over A and take the sum of product of corresponding elements of A and B, then find the minimum of those sum ...
25
votes
15answers
2k views
Check if point lies inside triangle
Your goal is to determine whether a given 2D point X lies within the area of the triangle with given vertices A,B,C.
Write a function that takes in the coordinates of the test point X and the three ...
0
votes
0answers
103 views
Write a simple markdown editor [on hold]
The aim is to write a markdown editor.
What functions this markdown editor will have:
wrapping text in asterisks (*text*) will emphasize it (text)
wrapping text in double asterisks (**text**) will ...
-2
votes
0answers
91 views
Which programming language is REALLY best for economics? [on hold]
So I was browsing a blog I enjoy and saw a comparison of programming languages in economics and for a few of the languages the code is written horribly. I have the source code they used below and I ...
4
votes
7answers
260 views
Give me the Gray Code list of bit width n [duplicate]
The Gray Code is a sequence of binary numbers of bitwidth n where successive numbers differ only in one bit (see example output).
Reference
Example input:
3
Example output:
000
001
011
010
110
...
-3
votes
0answers
138 views
Calculate pi - I mean e [duplicate]
Write a program which appears to calculate pi, but which actually calculates e.
The program must actually calculate; it can not load from another file, library constants, or the Internet. (Built-in ...
-4
votes
1answer
96 views
Keystone Program [on hold]
Today's challenge will be to create a program. A normal program that does normal things.
However, there must be one line in this program that looks very similar to the rest, that, when removed, makes ...
4
votes
3answers
565 views
Control Your Computer's Fan Speed
The objective of this question is to create a program that pushes your computer's internal fan speed to its maximum RPM. Upon exiting the program, your fan should return to the normal operating RPM.
...
1
vote
4answers
443 views
Rotate 2D Array [duplicate]
Given an input of a 2 dimensional array of integers, rotate the array 90 degrees clockwise.
It should work for rectangular arrays of all sizes and proportions.
The rotated array should be printed at ...
1
vote
5answers
364 views
Detect the newest file and pass it to a process
Challenge
Detect the newest file in a specific folder and pass it as an argument to another process. The first argument to your program will be the folder, and the second argument will be the full ...
-5
votes
3answers
164 views
Div in a div in a div [on hold]
Here's an interesting idea. Could someone create a loop that duplicates a div within a div for 20 times?
Sound easy?
Try making the background colour for each div different, but have the first 10 ...
14
votes
7answers
1k views
Calculate cell-phone keypresses
Your task is to calculate the total number of key-presses required to enter a given text on an old cellphone.
The keymaps are:
1:1
2:abcABC2
3:defDEF3
4:ghiGHI4
5:jklJKL5
6:mnoMNO6
7:pqrsPQRS7
...
1
vote
0answers
114 views
Aeroplane sitting plan [on hold]
An airlines company has several planes of the same type.Each plane has a seating capacity of 24 X 3 rows and 8 seats in each row split has shown.
1 [a] [b] [c] [d] [e] [f] [g] [h]
2 [a] [b] [c] [d] ...
6
votes
4answers
705 views
Tips for Golfing in T-SQL?
What general tips do you have for golfing in T-SQL? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to T-SQL. Please post one tip per ...
66
votes
38answers
4k views
Survival Game - AlienWar
AlienWar
This game takes place in a very crowded planet where aliens are the superior race. Your task is to create your own alien and beat all other.
The Board
It is a 2 dimensional board.
The ...
0
votes
1answer
360 views
Racketeer Taxi Driver
The Scenario
You are a taxi driver in your city. You picked up a passenger from the airport and he told you the place he'd like to go.
To earn more money, you need to drive as much as you can. ...
33
votes
30answers
4k views
ETAOIN SHRDLU golf
Short and sweet description of the challenge:
Based off ETAOIN SHRDLU, your challenge is to write the shortest program or function in any language that outputs the 26 letters of the English alphabet ...
-1
votes
0answers
206 views
Sequence Printing [closed]
In this challenge, you get an array of integers. Some of these integers are consecutive, others are not. The goal is to write the consecutive numbers as a range (1-3) instead of separate integers ...
47
votes
14answers
7k views
“Disprove” Fermat's Last Theorem
Write a program, in the language of your choice, that appears to successfully find a counterexample to Fermat's Last Theorem. That is, find integers a, b, c > 0 and n > 2 such that an + bn = cn.
Of ...
12
votes
5answers
657 views
PI window encryption
This is a simple encryption method that uses PI digits to encode a message, the method is simple:
The key is just a positive integer that indicates where the window starts then:
Given a string to ...
3
votes
5answers
331 views
Convert binary search tree into ordered linked list
Write the shortest possible program that turns a binary search tree into an ordered doubly-linked list, by modifying the pointers to the left and the right children of each node.
Arguments: a pointer ...
12
votes
9answers
1k views
Create a World Cup guessing program
As you know, the World Cup group stage is over, and from tomorrow the best 16 teams will commence the knockout stage:
Brazil (BRA)
Mexico (MEX)
Netherlands (NED)
Chile (CHI)
Colombia (COL)
Greece ...
1
vote
1answer
124 views
Sum up a number in words [duplicate]
Here's a simple one.
In the shortest code possible, given an arbitrary number such as 567421, print it out in words:
five
six
seven
four
two
one
You may assume the input is an integer that is ...
-1
votes
1answer
471 views
A Most Excellent Code Golf Adventure
You dudes, the Most Excellent Adventure is a home brew roleplaying game system based on the Bill & Ted Films, plays gnarly air guitar riff.
In this game system, when you draw from your dice pool ...
14
votes
9answers
2k views
Simulate rotating a board
Introduction
You're playing a matching game, in which coins are inserted at the top and fall to the bottom (onto the top coin) due to gravity.
So this
O <- inserting this coin
OO O
OOOOO
will ...
25
votes
5answers
1k views
+50
To Vectory! – The Vector Racing Grand Prix
Vector racing is an addictive game that can be played with a pen and a sheet of square-ruled paper. You draw an arbitrary racetrack on the paper, define a start and end and then you steer your ...
-1
votes
1answer
144 views
Calculate number of characters in code [closed]
The task is to find the number of characters in your source code up to the previous line.
You may do some addition of two integers, or whatever that comes to mind. But at the end of your logic, you ...
13
votes
0answers
422 views
Create a chatbot for the Stack Exchange chatrooms
The challenge
The goal of this challenge is to create a chatbot that can run in the chatrooms of Stack Exchange. Your bot needs to be able to detect when specific commands are posted by a user and ...
14
votes
13answers
738 views
Print the relative path
Description
Given a source path and a destination path, output the relative path to the destination with respect to the source.
Rules
The input can come from stdin or as arguments to the ...
6
votes
6answers
385 views
Find a binary tree's deepest node
Write a program that takes a binary tree as input, and outputs the deepest node and its depth. If there is a tie, print all involved nodes as well as their depths. Each node is represented as:
T(x,x)
...
25
votes
41answers
3k views
Find max sequence length
Assume we have a string, and we want to find the maximum repeated sequence of every letter.
For example, given the sample input:
"acbaabbbaaaaacc"
Output for the sample input can be:
a=5
c=2
b=3
...
3
votes
1answer
198 views
Finding internal rate of return (IRR)
In investing, internal rate of return (IRR), the continuously compounded rate of return economically equivalent to a specified series of cashflows, is often a valuable concept.
Your challenge is to ...
4
votes
2answers
573 views
Longest mathematical expression in a grid
Given a grid which contains these signs: 0..9, x, =, write the fastest code that outputs the longest string of connected (horizontally, vertically, and diagonally adjacent), distinct cells which is a ...
-2
votes
0answers
38 views
Spring Java Excel file download garbled but emails just fine [migrated]
So, I have a perplexing problem. I'm creating an excel file with org.apache.poi 3.10.
I can email the excelfile:
MimeMessagePreparator mimeprep = new MimeMessagePreparator() {
@Override
...
15
votes
16answers
3k views
Find the maximum of 3 numbers without branching
This time around your goal is to find the maximum of 3 integers (from -(2^31) to 2^31 - 1 in binary 2's complement) without using branching or loops.
You are only allowed to use
...
15
votes
7answers
960 views
Write a word equation solver
Introduction
Consider the following example:
CODE
+ GOLF
——————
GREAT
This is an equation where each letter represents a decimal digit and the words represent natural numbers (similar letters ...
6
votes
19answers
3k views
9 Digit Problem
Write a program to find a number consisting of 9 digits in which each of the digits from 1 to 9 appears only once. This number must also satisfy these divisibility requirements:
The number should be ...