42 votes
Accepted

Count trailing truths

Dyalog APL, 6 2 bytes ⊥⍨ Test it on TryAPL. How it works ⊥ (uptack, dyadic: decode) performs base conversion. If the left operand is a vector, it performs ...
Dennis's user avatar
  • 210k
37 votes

Stretch the word

Jelly, 4 bytes ;\f" Try it online! How it works ...
Dennis's user avatar
  • 210k
36 votes

Covering a Skyline with brush strokes

JavaScript (Node.js), 38 bytes a=>a.map(v=>(n+=v>p&&v-p,p=v),p=n=0)|n Try it online! Simply a greedy algorithm which scan from left to right, ...
tsh's user avatar
  • 34.7k
33 votes

Counting and so on

Python 3, infinity points ...
gsitcia's user avatar
  • 3,301
31 votes

Covering a Skyline with brush strokes

05AB1E,  8 7  5 bytes Saved 2 bytes thanks to @Adnan 0š¥þO Try it online! How? This is using the algorithm that was first found by @tsh. If you like this answer, ...
Arnauld's user avatar
  • 192k
30 votes

Slash the matrix

MATL, 21 bytes 3XytPJ*-X*Xj~4&1ZIunq The input is a matrix with 1 for \ and ...
Luis Mendo's user avatar
  • 104k
28 votes

How many lights are on?

MATL, 19 18 17 13 bytes 5 bytes off thanks to @LeakyNun's idea (see his answer) of using the imaginary unit as a base for exponentiation. Jj11\^Ys8#uos Try it ...
Luis Mendo's user avatar
  • 104k
24 votes
Accepted

Detriplicate a string

Jelly, 6 bytes Qx2œ&@ Try it online! or verify all test cases. How it works ...
Dennis's user avatar
  • 210k
23 votes
Accepted

Find the "unwrapped size" of a list

Retina, 1 byte ] Try it online! (The first line enables a linefeed-separated test suite.) By default, Retina counts the number of matches of the given regex in ...
Martin Ender's user avatar
23 votes

Cantor's unspeakable numbers

Python 2, 77 75 74 70 bytes Thanks to @MartinEnder for suggesting the limit of 9e5 which enderd up working after a change.Thanks to @mschauer for suggesting an ...
PurkkaKoodari's user avatar
23 votes
Accepted

How much do I have to write?

05AB1E, 3 bytes Code: ÝJg Uses the CP-1252 encoding. Try it online! Explanation: ...
Adnan's user avatar
  • 44.4k
22 votes
Accepted

Checkmate (aka the urinal problem)

Oasis, 5 bytes Code cd+2V Extended version cd+211 Explanation ...
Adnan's user avatar
  • 44.4k
21 votes
Accepted

Determine the depth of an array

K, 4 bytes #,/\ In K, ,/ will join all the elements of a list. The common idiom ,// ...
JohnE's user avatar
  • 5,062
21 votes

Stretch the word

Pyth, 6 bytes Thanks to @Doorknob for taking off 1 byte. Thanks to @Maltysen for taking off 5 bytes. s@VQ._ Try it online! How it works For example, take the ...
Leaky Nun's user avatar
  • 49.7k
21 votes

GET your dubs together

Mathematica, 29 bytes How about an arithmetic solution? IntegerExponent[9#+#~Mod~10]& I'm very pleased to see that this beats the straight-forward ...
Martin Ender's user avatar
21 votes

A scene of Jimmy diversity

Python 3.8 (pre-release), 51 bytes lambda s:((c:=s.count)('o')-c('/'),c('/o'),c('/-')) Try it online!
Erik the Outgolfer's user avatar
20 votes

Prime Wednesdays

Python 2, 95 93 68 67 bytes lambda y:0x10ea2c8dbb06c5619/5**((y+((y-22)/99-y/2002)*16)%28)%5+16 Thanks to @Josay for golfing off 1 byte! Test it on Ideone.
Dennis's user avatar
  • 210k
19 votes

How many lights are on?

Python, 68 bytes 25 bytes thanks to Sp3000. 2 bytes thanks to Luis Mendo's idea of taking modulus with 11. 17 bytes thanks to xnor. ...
Leaky Nun's user avatar
  • 49.7k
19 votes

Count trailing truths

JavaScript (ES6), 21 bytes f=l=>l.pop()?f(l)+1:0 Test cases ...
Arnauld's user avatar
  • 192k
18 votes

A penny saved is a penny

Haskell, 37 34 bytes s#l@(c:d)|s>=c=(s-c)#l+s#d s#_=0^s Usage example: 26 # [1,5,10,25] -> ...
nimi's user avatar
  • 35.8k
17 votes

Zeroes in interval

Jelly, 1 byte ¬ This uses base k+2, in which case there's a single 0 iff i is 0. It takes ...
lirtosiast's user avatar
  • 21.5k
16 votes

How long is a Welsh word?

Retina, 23 bytes i`[cprt]h|dd|ff|ng|ll|. Try it online! Even moar regex.
user48538's user avatar
  • 1,542
16 votes

Count forth and back then double up

JavaScript (ES7),  59 ... 44  43 bytes Saved 1 byte thanks to Titus Expected input: 1-indexed. n=>(n-=(r=(~-n/2)**.5|0)*r*2)<++r*2?n:r*4-n Initially inspired ...
Arnauld's user avatar
  • 192k
16 votes

Replace all items with their counts

Python 2, 23 bytes lambda l:map(l.count,l) Try it online!
xnor's user avatar
  • 145k
15 votes

Determine the depth of an array

Retina, 10 Saved 1 byte thanks to @ӍѲꝆΛҐӍΛПҒЦꝆ Saved 14 extra bytes thanks to @MartinBüttner +`\w|}{ { Here the input format is a bit contrived - _ characters ...
Digital Trauma's user avatar
15 votes

Detriplicate a string

JavaScript (ES6), 42 48 Edit A whopping 6 bytes saved thx @Neil s=>s.replace(k=/./g,c=>(k[c]+=c)[11]?'':c) Explanation: I use the properties 'a'...'z' of ...
edc65's user avatar
  • 32.1k
15 votes

Count to 100 in Danish

JavaScript (ES6), 347 336 326 325 308 bytes ...
ETHproductions's user avatar
15 votes

A penny saved is a penny

Mathematica, 35 22 bytes Thanks to miles for suggesting FrobeniusSolve and saving 13 bytes. Length@*FrobeniusSolve Evaluates ...
Martin Ender's user avatar
15 votes

GET your dubs together

Retina, 9 bytes &`(.)\1*$ Try it online! Counts the number of overlapping matches of (.)\1*$ which is a regex that ...
Martin Ender's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible