Search Results
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 |
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
0
votes
Shortest code to produce infinite output
Windows PowerShell (12)
for(;;){'-'}
0
votes
Shortest code to produce infinite output
Python: (16 characters)
while 1:print(0)
0
votes
Count the words in a text and display them
C# (332)
This is my original program after excluding white spaces. Please pardon me if I did mistake in counting
using System;
using System.Collections.Generic;
using System.Linq;
class P
{ …
-1
votes
Shortest code to produce infinite output
C# (72)
using System; class P {static void Main(){for(;;) Console.Write('-');}}
Output
0
votes
Fill empty spaces by filling empty blanks
C#, 265 bytes
Golfed (265 Characters)
static void placeAt(String[]Q,int P){int I;if(Q[P]=="0"){Q[P]="1";}else{I=Array.IndexOf(Q,"0");if(I>=0){if(I<P){for(int i=I;i<=P;i++){Q[i]=(i==P)?"1":Q[i+1];} …
0
votes
Produce the number 2014 without any numbers in your source code
C# (56 characters)
Class P{static void Main(){Console.Write(','*','+'N');}}
1
vote
Shortest method to implement the Pythagorean Theorem
C#
Method Only (114)
void H(double a, double b)
{
Console.Write("The hypotenuse of this right triangle is {0:N3}", Math.Sqrt(a * a + b * b));
}
Complete Program (171)
using System;
class P
{ …
3
votes
Code me a cookie
C#
With indentation and line break
using System;
class Cookie
{
static void Main()
{
String E="",N="",C=Console.ReadLine();
if(C=="P"){E=" ";N=" ";}
if(C=="C"){E=". .";N …
1
vote
Shortest Program to Sort a List of numbers into Odd and Even Category
C# 174
using System;class P{static void Main(){double[] L={20,9,4,5,5,5,15,17,20,9};double O=0,E=0;foreach(int i in L){if(i%2==0)E+=i;else O+=i;}Console.Write(Math.Sqrt(E*E+O*O));}}
Readable
using …
2
votes
Convert a 32 bit binary IPv4 address to its quad-dotted notation
Python 3 (125 bytes)
def f(x):
y=''
for j in range(4):
y+=str(int(x[j*8:j*8+8],2))
if j<4:
y+="."
return y
Try it online
2
votes
Check whether an integer is a power of 2 without using +,- operations
C# (54 characters)
Math.Log(int.Parse(Console.ReadLine()),2)%1==0?"Y":"N"
0
votes
Convert JSON string to Key / Value Arrays
Python 3 (Total 35 characters)
Input JSON String
X = '{"a":"a","b":"b","c":"c","d":"d","e":"e","f":"f9","g":"g2","h":"h1"}'
Get Keys(16 characters)
k=eval(X).keys()
Get Values(18 characters)
…