Posts by Hakerh400
JavaScript, 11 solutions !``<<!``<<!``<<!``<<!``<<!``<<!``<<!``<<!`` TIO 2**2**2*2**2**2 TIO 55555555555555555555555555555555555555555555555...
JavaScript (Node.js), 74 70 bytes Works for any number of dimensions. f=(a,z=[])=>a.map?.((b,c)=>z.push(...f(b).map(a=>[c,...a])))?z:a?[z]:z Try it online! (TIO uses an old version ...
JavaScript, 25 24 bytes -1 byte thanks to @Arnauld f=([a,...b])=>a?f(b)+a:b Try it online!
JavaScript (Node.js), 137 136 117 bytes with(Math)f=n=>(m=(a,b)=>a?m(--a,b)+b(a):[])(28,y=>m(55,x=>x>26-y&x<y+28&(x^y)?min(abs(abs(27-x)-y)/2,27-y):' ')+` `) Try it...
Cracks Shaggy's answer Let the cops be "Cops" The conjunction is " and " The robbers are "Robbers" Say the cops with the conjunction with the robbers It can be one of: FALSE Phooe...
Definitions A binary tree is either a null (leaf), or an object (node). A node contains a value (non-negative integer) and two pointers (left and right) to two separate binary trees. A binary tre...
JavaScript (Node.js), 147 bytes f=(a,b='IVXLCDM',g=Math.log10(a)<<1,c=10**(g/2),e=a/c|0,i=b[g+1],j=a=>b[g].repeat(a))=>a?(e<4?j(e):e<6?j(5-e)+i:e<9?i+j(e-5):j(1)+b[g+2])+f(a...
JavaScript (Node.js), 541 540 bytes for(_='=>)==!(+==0h,.map(M,R(=1,,e,b &&Nl=[-1,))s(n,=(a a=u,v(i=g(z,u,f=(a,w,cs=Math.max,r?[...r(--a ) (a)]:[],R>&b>&a<w&b<...
Common Lisp, 26 22 bytes (princ"Hello, World!") -4 bytes thanks to @Sisyphus Try it online!
JavaScript (Node.js), 40 bytes f=(a,b,c=1)=>a.reduce((d,e)=>d+e*(c*=b)) Try it online!
Haskell, 24 bytes Probably the optimal solution. Credits go to nimi from PPCG. f n=elem n$map(^2)[0..n] Try it online! My original solution, 25 bytes f a=any((==a).(^2))[0..a] Try it ...
JavaScript (Node.js), 150 71 bytes f=(a,b)=>a[b.length]?f(b,a):b.filter(x=>a[y=a.indexOf(x)]=!~y).length-1 Try it online!
JavaScript (Node.js), 78 bytes (m=(a,b=26,c=a(--b))=>b?[c,...m(a,b),c]:[c])=>m(a=>m(b=>(c=25-a-b)<0?32:c+65)) Try it online!
JavaScript (Node.js), 64 bytes for(n=0;101>++n;)console.log([['Fizz'][n%3]]+[['Buzz'][n%5]]||n) Try it online!
Haskell, 141 bytes import Control.Monad f a=map(map fst)$filter(\c->let{g=map snd;e=sum(g a)`div`2;f=g c;d=sum f}in d>e&&all((<=e).(d-))f)$filterM(pure[1<0..])a Try it ...
JavaScript (Node.js), 60 bytes f=a=>console.log(`)(f;${[...f+``].reverse``.join``}=f`);f() Try it online!
Haskell, 78 bytes main=putStr$reverse$a++show a where a="main=putStr$reverse$a++show a where a=" Try it online!
Haskell, 51 49 bytes -2 bytes thanks to Wheat Wizard 1:g[2..] g(a:b)=a:g[d|(c,d)<-zip[1..]b,c`mod`a>0] Try it online!
Haskell, 43 39 bytes f 1=0 f n=1+f([div n 2,n*3+1]!!mod n 2) Try it online!
Haskell, 139 138 bytes import Data.Char f(a:b)|d a=toUpper a:f(dropWhile(\a->e a"-'"||d a)b)|e a":;"=a:c|e a".?!"=' ':c|0<1=c where c=f b;d=isLetter;e=elem f a=a Try it online!
Haskell, 56 bytes f a=a:f(a+g(read.pure<$>show a)) g a=minimum a+maximum a Try it online!
Haskell, 78 77 bytes (g[0]!) g a=mapM(\_->[-1..1])a++g(0:a) (a:b)!c|foldl1((+).(*3))a==c=a|0<1=b!c Try it online!
Haskell, 110 bytes f a=s>>=(#)$a++reverse a c@(a:b)!f=f c:b!f _!_=[] f#n=n!((n!).f) s(p:q)(d:e)(b:c)|e==c||e==[]=b|q==c=d|0<1=' ' Try it online!