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.
7
votes
Big or Little Endian
Java 8, 96, 64 52 bytes
()->(""+java.nio.ByteOrder.nativeOrder()).charAt(0);
A golf based on this SO answer. All credit goes to @LeakyNun and @AlanTuning. Java keeps the loosing streak.
96 bytes:
ch …
2
votes
Split a byte array into a bit array
Java, 313 306 322 bytes
I hope this beats PHP...
And nope. Stupid long function names.
-7 thanks to @quartata for getting rid of public
+16 to fix an error when the split was exact, thanks to @TheCode …
0
votes
Random word-sentence-story generator
Python 2.7, 156 149 135 131 bytes
Screw efficiency, as long as it's short.
Saved 7 bytes thanks to @TuukkaX on the import statement
Saved 14 bytes thanks to @KevinLau-notKenny for negative list indice …
3
votes
Print all alphanumeric characters plus underscore
Brainfuck, 114 103 98 90 76 71 bytes
Another trivial (now non-trivial) solution, but this time is BF!
Saved 14 (!) bytes thanks to @primo.
Saved 4 more bytes thanks to @primo's suggestion to generate …
3
votes
Efficiently generate all vector partitions
Python 2, 289 bytes
Simple brute force algorithm. Treats entire list as a number in base max(input)+1 (b), and checks each "number" in the range [0, b**(L*M)) to see if it:
Sums to the correct amount …
3
votes
Find the powertrain!
Java 8, 265 244 229 bytes
This is my first answer, but I have been reading this site for a while and think I know what I'm doing. At least it beats befunge and SQL...
Unfortunately, like other answe …
5
votes
Exploded substrings
Python 2.7, 70 82 bytes
I couldn't figure out how to get it on 1 line. Call with e("abcde",0)
def e(s,p):
f=len(s)
for x in range(f):print(' '*p+s[:x+1])
if f>1:e(s[1:],p+1)
2
votes
Interpret DOGO!
Python 3, 388 398 373 371 bytes
Assumes 256 memory cells. Just a straightforward implementation, easily beatable, probably can be golfed more. Try it on repl.it.
Thanks to @EasterlyIrk for having me …
0
votes
Minimum cost block diagonalisation
Matricks, 180 bytes (noncompeting)
Matricks is a new esolang I created very recently to deal with matrix problems (such as this one), by only having 2 data types: floats and matricies. It is not full …
1
vote
Product over a range
Matricks, 24 bytes
Matricks is a new esolang I invented to deal with matrices. Run like: python matricks.py [[<num1>,<num2>]]
mg:;+c:1:g:1;-g:;;kp{};;
This is a simple answer. Matricks has a built …
3
votes
Expand a bash brace expansion
Python 2.7, 752 728 bytes
Wow, this is like a bunch of code golfs in one challenge!
Thanks to @Neil for shortening a lambda
def b(s,o,p):
t,f=s>':'and(ord,chr)or(int,str);s,o=t(s),t(o);d=cmp(o,s)
…
9
votes
Print out a shape in printable ASCII art based on a specific number of sides provided by the...
Java, 1887 1866 bytes
Try in on Ideone
Saved 21 bytes due to unneeded "public" headers (Thanks to @Bálint!)
Not exactly a golfing challenge, but hey, why not?
I feel Java might actually be the best la …
1
vote
Print/Output the L-phabet
Matricks, 37 bytes
m:26:26;Fs::[m90-Q:26-Q:26-Q;];:1:26;
Simple enough. Sets it to a blank 26x26 matrix, then consecutively overwrites the top left square with the correct ascii value.
Run with pytho …
7
votes
The IHIH Pyramid
Matricks, 80 62 bytes
An iterative solution (Recursion in Matricks is hard...)
Run with python matricks.py ihih.txt [[]] <input> --asciiprint
k124;FiQ%2:v;b[m124:Q*2+3:1;];a{z:Q*2+1;};:b;v[m45:1:Q*2+ …
1
vote
Depalindromize this string!
Hexagony, 56 bytes
This is awful, but I just wanted to do it in Hexagony :)
Golfed:
,<_..){/"./..\&..$@....>;{.....'..>"+"+"&"='&'&=}\}=.:(<
In a hexagon:
, < _ . .
) { / " . /
. . \ & . …