Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 1477

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

0 votes

Selective character count (only non-alphanumeric)?

Javascript 1.8 easy (48 chars) function f(s)(s.match(/[^a-z0-9]/gi)||[]).length
JiminP's user avatar
  • 3,462
4 votes
5 answers
520 views

Celsius - Fahrenheit anagram

Task Make a complete program or a function which calculates sum of all temperatures which, when written in Celsius and Fahrenheit scale, are anagram of each other. Description For example, 275 …
JiminP's user avatar
  • 3,462
3 votes
5 answers
2k views

Solve the knapsack problem

Knapsack Problem (Actually, this is a subset of real knapsack problem.... - there's nothing to optimize!) The knapsack problem is: Given positive integers , and an integer S, find non-negative i …
JiminP's user avatar
  • 3,462
0 votes

Change a non-floating point number the largest step

Python (13 chars, Difference: 9^(9^9) (369,693,100 digits!)) a=0;a=9**9**9 I believe that the result of this operation is not a float, isn't it? If that's problem because it doesn't yield the resu …
JiminP's user avatar
  • 3,462
2 votes

Reimplementing square root

ActionScript3 (53) Using Newton's method. (Hooray 4 IEEE 754) function s(b,d=2){return b==d*d?d:s(b,d-(d*d-b)/2/d)} I know I'm TOO late but I just wanted to write something I did :(
JiminP's user avatar
  • 3,462
1 vote

Is it Christmas?

Javascript, 93 89 78 77 chars function x(){Date().match("c 25")?alert("It's Christmas"):setTimeout(x,1)}x()
JiminP's user avatar
  • 3,462
1 vote

Hello World Rainbow

Dart to HTML, 135 134-1 = 133 main(){for(var s="Hello World",i=0;i<11;print("<font color=#${'F00F60FB0FF06F00F00B606B00F60F90F'.substring(i*3,i*3+3)}>${s[i++]}"));} Is there any way to color texts w …
JiminP's user avatar
  • 3,462
15 votes
9 answers
4k views

Write a function that returns past tense of given verb

Challenge Write a function which takes an argument which is a verb, and returns the past tense of the verb. (Assume that the verb is regular) Past tense Note: consider y as neither consonant no …
JiminP's user avatar
  • 3,462
12 votes
6 answers
1k views

Compute the difference between two days.

Another date-manipulating problem :P Task Write a program or a function that calculates the difference between two dates given by a user. Input & Output Similar to the previous one, inputs are …
JiminP's user avatar
  • 3,462
12 votes
7 answers
7k views

Write a self-replicating program.

Write a simple program that copies itself when executed. Your program should be some kind of executable file on Windows, Linux, etc.., should generate new executable file, which is identical to your …
JiminP's user avatar
  • 3,462
10 votes
5 answers
3k views

Make a simple IRC bot.

Task Make a simple IRC bot which does simple task like greeting user. Detail (You may see this RFC document.) Write a complete program that perform these: The program inputs nickname and realname f …
JiminP's user avatar
  • 3,462
12 votes
10 answers
1k views

What's the day today (or other dates)?

Task Write a program or a function that calculates a week-day name of a date which a user inputs. Input & Output Input is a string, YYYYMMDD. Example of input values: 20110617 : June 17, 2011 19 …
JiminP's user avatar
  • 3,462
2 votes

Shortest, lexicographically smallest generating string

Python, 161 159 166 140 141 134 132 chars y=raw_input();i=n=l=len(y) while i: if (y[:i]*l)[:l]==y:n=i i-=1 x=y[:n];y=x*2 while i<n: x=min(x,y[i:i+n]) i+=1 print x EDIT : Golfed the code after r …
JiminP's user avatar
  • 3,462
2 votes

ASCII Tux (Linux Penguin)

Brainfuck - 446 (441 if omit >>>>>. which prints \n) ++++++++[>++++++>>++++>>>-------->+>++++<<<<<<<<-]>-[->+>>++>++> ++++<<<<<]>>.....>+......>>>++.<<<<....<.>......>>--.>>.>...<<.< <<.<.>>>.<<..<.> …
JiminP's user avatar
  • 3,462
1 vote

Code-Golf: Permutations

JS - 154 146 chars function f(x){var a=[],m;(m=x.length)>1?f(x.slice(1)).map(function(y){for(l=m;l--;a.push(y.slice(0,l).concat(x[0],y.slice(l))));}):a=[x];return a} Test : f([1,2,3,4,5]).map(functi …
JiminP's user avatar
  • 3,462

15 30 50 per page