23
votes
14
votes
Convert Alpha-3 to Alpha-2
JavaScript (Node.js), 253 bytes
Saved 1 byte thanks to @MatthewJensen
Expects a string in upper case. Returns an array of 2 characters.
...
11
votes
Derivative of a product
Python, 54 bytes
lambda s:((l:=len(s))*(l*"'"+-~l*(s+"+")))[-~l*~l::-l]
Attempt This Online!
Python, 56 bytes
lambda s:((l:=-~len(s))*(l*(s+"+")+-~l*"'")...
10
votes
10
votes
Derivative of a product
C (clang), 69 64 59 bytes
-10 thanks to @Noodle9 and @ceilingcat
l;f(char*a){for(l=0;a[l];)printf("+%.*s'%s"+!l,++l,a,a+l);}
Try it online!
9
votes
ASCII-Art n'th Root
Python, 143 bytes
def f(a,b):
A=len(str(-a))&-2;print(A*" ",len(str(b))*"_"+f"\n{a:<{A}}/{b} = {b**(1/a):.{A}}");p="\\"
while A:A-=2;print(p+A*" &...
7
votes
7
votes
6
votes
1, 2, Fizz, 4, Buzz
rSNBATWPL, 57 bytes
for{i=1;i<101}$print{(("Fizz"*1>i%3)+"Buzz"*1>i%5)or++$i}
RSNBATWPL, or Radvylf Should Not Be Allowed To Write ...
6
votes
6
votes
Who needs 8 bits for one character?
JavaScript (ES7), 124 122 117 bytes
Expects (encoder_characters)(string), where string is passed as an array of characters.
<...
6
votes
Derivative of a product
Factor, 53 bytes
[ dup length [1,b] [ cut "'"glue ] with map "+"join ]
Try it online!
If the order of each product doesn't matter:
Factor, 43 ...
6
votes
ASCII-Art n'th Root
JavaScript (ES8), 158 156 bytes
Expects (a)(b), where both arguments are strings.
...
6
votes
6
votes
ASCII-Art n'th Root
Charcoal, 37 bytes
θ⸿↘⊘⊕Lθ↑↗⊘⁺³Lθ⟦⭆η_⟧η = ﹪⁺⁺%.LθfXIη∕¹N
Try it online! Link is to verbose version of code. Explanation:
θ
...
6
votes
Haplololololololology!
Jelly, 45 38 bytes
ḷⱮjⱮƤ““ “-”ẎʋƤṖe@€i1ḣ@ȯ
ŒṖÇƑÐḟẈṢṚƲÞṪÇ€
Try it online!
Should be correct for real this time thanks to Tanner Swett.
Should be correct for real ...
5
votes
Spell out an integer... in NDos' way
Charcoal, 86 bytes
⊞υNWυ«≔⊟υι¿ι«≔⌕⮌÷¹⊕↨ιχ⁰θ≧÷Xχθι§⪪”↶0OP⊘ηS℅ê*k⮌⁰nI¿'⊗ξ!»NV”³ι≧÷χι⊞υι⊞υθ¿θ¿ιom¦eh¿ιat¦em→
Try it online! Link is to verbose version of code. ...
5
votes
Shift a string gradually
Jelly, 7 6 bytes
Thanks to @ovs for suggesting looking at swapping the argument order and hence saving a byte!
J+i@€ị
A dyadic Link that accepts the instruction ...
5
votes
5
votes
Shift a string gradually
Pip, 15 bytes
(b(b@?B)+U_MEa)
Takes the two strings as command-line arguments. Attempt This Online!
Explanation
...
5
votes
5
votes
Convert Alpha-3 to Alpha-2
Wolfram Language (Mathematica), 115 bytes (uses builtin libraries)
Turns out there's a builtin for everything! There was a restriction against using internet connectivity, so I'm not sure if the ...
5
votes
Shortest restricted superstring
Python, 150 bytes
f=lambda D,R,m=min:m([h for d in D for e in f(D-{d},R,sorted)for x in range(len(d)+2)if(d in(h:=(d+"_")[:x]+e))>any(r in h for r in R)]or[""],key=len)
Attempt ...
5
votes
5
votes
Derivative of a product
Wolfram Language (Mathematica), 45 36 bytes
aRiffle[a/.#->#<>"'"&/@a,"+"]<>""
Try it online!
Input ...
5
votes
Derivative of a product
JavaScript (Node.js), 83 \$\cdots\$ 72 69 bytes
s=>g=(r="",i=0)=>s[i]?g(r+("+"+s).slice(!i,++i+1)+"'"+s.slice(i),i):r
Try it ...
5
votes
Derivative of a product
JavaScript (Node.js), 46 44 bytes
l=>[...l].map(s=>l.replace(s,s+"'")).join`+`
Try it online!
-2 bytes thanks to emanresu A
5
votes
5
votes
5
votes
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
string × 2075code-golf × 1948
ascii-art × 207
decision-problem × 126
kolmogorov-complexity × 125
parsing × 109
number × 94
code-challenge × 64
random × 60
natural-language × 56
math × 55
balanced-string × 52
restricted-source × 45
array × 45
grid × 44
subsequence × 38
arithmetic × 36
sorting × 35
source-layout × 35
sequence × 34
permutations × 34
alphabet × 34
date × 32
counting × 30
integer × 27