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 53466

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

1 vote

Transpose a page of text

Groovy, 98 chars {i->o=[].withDefault{''};i.readLines().each{it.toList().eachWithIndex{c,d->o[d]+=c}};o.join('\n')} online ungolfed: {i-> o=[].withDefault{''};//create list with empty string as d …
Krzysztof Atłasik's user avatar
1 vote

The Rule of Thumb for Title Capitalization

Groovy, 131 129 Two bytes saved thanks to carusocomputing {it.split()*.with{a->a in "a an the at by for in of on to up and as but or nor".split()?a:a.capitalize()}.join(" ").capitalize()}
Krzysztof Atłasik's user avatar
1 vote

Golf Text into DNA

Groovy, 114 bytes {s->'ACGT'[(new BigInteger(((Byte[])s).join())*2).toString(2).toList().collate(2)*.with{0.parseInt(it.join(),2)}]} Explanation: {s-> 'ACGT'[ //access character from string …
Krzysztof Atłasik's user avatar
3 votes

Determine If a Challenge is Worth Answering

Groovy, 179 161 157 {i->t=new URL("http://ppcg.lol/q/$i").text;a=0;p=0;(t=~/"(?i)p.{25}>\n.*python/).each{p++};(t=~/(?m)v.{13}t ">(\d+)/).each{if(it[1].toLong()>3)a++};a>5&&p<2} Thanks to Timtech 1 …
Krzysztof Atłasik's user avatar
1 vote

Briefest code to find vowels and print consonants

Groovy, 181 177 bytes online ​{i->r=[:].withDefault{0};o=i.toLowerCase().replaceAll(/[aeiou]/,{r[it]++;''}) "Enter String: $i\nVowel Count: ${r.collect{k,v->"$k: $v"}.join(' ')}\nRemaining character …
Krzysztof Atłasik's user avatar
1 vote

Diamondize a Matrix

Groovy, 77 73 75 {i->o=[].withDefault{[]};a=0;i.each{b=0;it.each{o[a+b++].add(0,it)};a++};o} Takes array of arrays as input and returns array of arrays. Try it EDIT: I forgot to output the anwser …
Krzysztof Atłasik's user avatar