-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Inspired by http://xkcd.com/710/ here is a code golf for it.
The Challenge
Given a positive integer greater than 0, print out the hailstone sequence for that number.
The Hailstone Sequence
See Wikipedia for more detail..
If the number is even, divide it by two.
If the number is odd, triple…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
The Challenge
The shortest code by character count to display a representation of a circle of radius R using the *character, followed by an approximation of p.
Input is a single number, R.
Since most computers seem to have almost 2:1 ratio you should only output lines where y is odd.
The approximation…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
The Challenge
The shortest code by character count to display a representation of a circle of radius R using the *character. Followed by an approximation of pi
Input is a single number, R
Since most computers seem to have almost 2:1 ratio you should only output lines where y is odd.
The approximation…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383
The Problem
Assume the user gives you a numeric input ranging from 1 to 7. Input should be taken from the console, arguments are less desirable.
When the input is 1, print the following:
***********
*********…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Post your shortest code, by character count, to check if a player has won, and if so, which.
Assume you have an integer array in a variable b (board), which holds the Tic Tac Toe board, and the moves of the players where:
0 = nothing set
1 = player 1 (X)
2 = player 2 (O)
So, given the array b…
>>> More
-
as seen on Google Code
- Search for 'Google Code'
Given a list of cell phone towers, the cost or gain of upgrading each one, and the requirement that every upgraded tower can only have upgraded towers in...
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
This is not a homework question, but rather my intention to know if this is what it takes to learn programming. I keep loggin into TopCoder not to actually participate but to get the basic understand of how the problems are solved. But to my knowledge I don't understand what the problem is and how…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hey Guys,
I'm participating in the 2010 code jam and I solved two of the problems for the small data sets, but I'm not even close to solving the large data sets in the 8 minute time frame.
I'm wondering if anyone out there has solved the large data set:
What hardware were you running on?
What…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
In Google Code Jam 2009, Round 1B, there is a problem called Decision Tree that lent itself to rather creative solutions.
Post your shortest solution; I'll update the Accepted Answer to the current shortest entry on a semi-frequent basis, assuming you didn't just create a new language just to solve…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Last year (2009), the Google Code Jam featured an interesting problem as the first problem in Round 1B: Decision Tree
As the problem seemed tailored for Lisp-like languages, we spontaneously had an exciting codegolf here on SO, in which a few languages managed to solve the problem in fewer characters…
>>> More