Hot answers tagged

9 votes

Rarity of a String

05AB1E, 27 26 bytes A2úœ•ι9η†₁Ù^Pι²Qš•èIk4÷3-O Input as a list of characters. Try it online or verify all test cases. (With ...
9 votes

Rarity of a String

Python, 63 bytes lambda x:sum('inshrdlcmumuwfgykvbpjqxz'.find(c)//4-2for c in x) Attempt This Online! Port of @Neil's not yet written charcoal answer. ;-p
  • 11.1k
8 votes

Maximum average ord

Pyth, 7 bytes eSm.OCM Test suite Explanation: ...
  • 4,676
8 votes

Number to letters

JavaScript (Node.js), 49 bytes ...
  • 173k
8 votes

Rarity of a String

K (ngn/k), 38 37 bytes +/3--4!24^"jqxzkvbpwfgymumurdlcinsh"? Try it online! Essentially a port of Kevin's 05AB1E answer. ...
  • 5,153
8 votes

Rarity of a String

Java 8, 63 62 bytes s->s.map(c->"␁ ␆ ␃ ␃ ␁ ␅ ␅ ␂ ␂ ␇ ␆ ␃ ␄ ␂ ␁ ␆ ␇ ␃ ␂ ␁ ␄ ␆ ␅ ␇ ␅ ␇".charAt(c-97)-4).sum() Try it online. Explanation: ...
8 votes

Rarity of a String

Excel (ms365), 87, 86, 80 bytes -1 Byte thanks to @DominicvanEssen -6 Bytes thanks to @jdt ...
  • 1,241
7 votes

Number to letters

Python 3.8 (pre-release), 58 bytes f=lambda s:s and chr(97+int(s[:(I:=1+(s<"26"))]))+f(s[I:]) Try it online! This is based on the observation that we ...
  • 11.1k
6 votes

Is this series of quotes valid Python?

C (GCC), 132 130 109 108 bytes -12 bytes thanks to @ceilingcat -9 bytes thanks to @jdt -1 bytes thanks to @c-- ...
  • 3,690
6 votes

Maximum average ord

K (ngn/k), 18 11 bytes |/{+/x%#x}' Try it online! Massive -7 bytes golf thanks to Steffan! Damn everyone is answering quick. Anyways here's my solution. Takes ...
  • 1,665
6 votes

Rarity of a String

Vyxal, 26 bytes «ƛ₇⇩⇧ɽ¬Ẏ₁5≬*⋎ǑṄǑz!«vḟ4ḭ3-∑ Try it Online! Port of Kevin's 05AB1E answer. Explained (old) I'll rework this tomorrow when it's not 12:59am ...
  • 24.5k
6 votes

Rarity of a String

><> (Fish), 62 60 bytes Rare case where ><> beats python -2 bytes because I can't be beaten by Java, and by poluting the stacks. ...
  • 4,636
6 votes
Accepted

Rarity of a String

Nibbles, 17.5 bytes (35 nibbles) +.$- 3=?;$$`D7 3c2740e64a52f8f4a8d A rather sneaky port of hakr14's Pyth answer: upvote that! ...
5 votes

1, 2, Fizz, 4, Buzz

Jellyfish, 124 105 98 97 92 bytes P L,L, v"Buzz 1 1v"Fizz E $X$,,S LvLjXX *4 1 0*rE101b6 $R * E4 ,1N1b19252 100 Try it online! Try the 97B ...
5 votes

Unslice a string

Factor, 64 40 bytes [ sbuf new tuck '[ _ copy ] assoc-each ] Attempt This Online! This answer makes use of the fact you can set arbitrary indices of a growable ...
  • 13.3k
5 votes

Is this series of quotes valid Python?

Regex (Javascript/PCRE), 31 28 bytes -3 bytes thanks to Neil and Mukundan314 ...
  • 4,636
5 votes

Maximum average ord

Wren, 68 bytes Fn.new{|x|x.reduce(0){|y,z|y.max(z.bytes.reduce{|a,b|a+b}/z.count)}} Try it
  • 13.3k
5 votes

Maximum average ord

APL(Dyalog Unicode), 14 13 bytes SBCS -1 bytes thanks to Adám ⌈/+⌿∘⎕UCS¨÷≢¨ Try it on APLgolf! A tacit function which finds the maximum ord. Originally wrote a dfn,...
  • 9,911
5 votes

LS, Part 1: Ana Gram

Python, 106 bytes -12 by mousetail, Kevin Cruijssen -5 by Jitse ...
  • 1,073
5 votes

Implement Casio's M

Python3, 287 bytes: ...
  • 4,465
5 votes

Number to letters

><> (Fish), 83 bytes >i:0(?;'0'-:2(?v:2=?v'a'+o ^ o+'a'+-'0'i*a< +'a'~$o'c'v?(6:-'0'i<.01o 1o+'a'+*a$<.0 Link Top row is basic reading lines ...
  • 4,636
5 votes

Number to letters

Retina 0.8.2, 32 bytes 2[0-5]|[01]?. $*#a +T`##l`_l`#\w Try it online! Link includes test cases. Explanation: 2[0-5]|[01]?. ...
  • 150k
5 votes

Rarity of a String

Python, 80 79 bytes -1 byte thanks to @Mukandan314 lambda x:sum(map(int,x.translate('0'*98+'5220441165231056210354646')))-len(x)*3 Attempt This Online!
  • 4,636
5 votes

Rarity of a String

Python, 70 64 bytes lambda x:sum(int(b'"v4!g2euqc1U'.hex()[ord(c)%26])-4for c in x) Attempt This Online! -6 bytes thanks to @loopy walt and @Steffan
  • 7,129
4 votes

Unslice a string

J, 24 bytes [:u:3>./@u:-@(+#&>){.&>] Try it online! alternative, 24 bytes ...
  • 30k
4 votes

Indexize a number

J, 14 bytes ~.".@/:1#.I.@= Accepts a string, returns a number. Attempt This Online! ...
  • 701
4 votes

Length of Longest Non-Repeating Substring

Julia 1.0, 98 74 73 bytes ~=length !s=max(.~filter(z->[z...]==z∪z,[s[x:y] for x=1:~s,y=1:~s])...) Try it online! -3 bytes thanks to @amelies: replace ...
4 votes

Alphabet Checksum

Gaia, 16 15 bytes ⟨c97%⟩¦Σ26%97+c Try it online! Pretty standard implementation of what the challenge asks. I was able to save a byte thanks to the golfing advice ...
  • 161
4 votes

Alphabet Checksum

K (ngn/k), 16 14 bytes `c$97+26!+/97! Try it online! -2 bytes thanks to coltim! Explanation: ...
  • 1,665
4 votes

Maximum average ord

Python, 46 bytes lambda l:max(sum(map(ord,s))/len(s)for s in l) Attempt This Online! Unfortunately, the only built-in mean ...
  • 3,108

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