Posts by Zakk
Lua 5.4.4, 99 bytes _=0s:gsub('.',function(c)_=({d=_-1,i=_+1;s=_*_})[c]or print(_)or _ _=({[256]=0,[-1]=0})[_]or _ end) Try it online! Thanks to @orthoplex for more shortening.
Lua 5.4, 3 unique characters #'#'/#'##' Try it online! [...] scoring is done in terms of number of unique characters used in the submission. Hashtag # Single quote ' Slash /
Lua 5.4, 67 60 bytes function(x)return x==1 and 0 or 1+f(({x/2,3*x+1})[x%2+1])end Attempt This Online! Credits to @Moshi for more shortening.
Lua 5.4.4, 147 bytes local function f()goto l::l::return end for _ in f do end if true and false then elseif""then else end repeat until""or not nil while""do break end Try it online! Check th...
C (gcc), 98 bytes _=0;f(char*s){for(;*s;++s)_==256||_<0?_=0:1,*s=='i'?_++:*s=='d'?_--:*s=='s'?_*=_:printf("%d ",_);} Try it online!
C (gcc), 43 38 bytes f(i){return i>1?f(i%2?3*i+1:i/2)+1:0;} Attempt This Online! Credits to @Moshi for shortening the code.
C (gcc), 59 bytes i;f(m,n){while(i<m*n){putchar(i%n?32:13);putchar(48+i++);}} Attempt This Online! m is the number of rows. n is the number of columns.
C (gcc), 41 bytes f(x,y){int r=x*y;return r&&r==x+y?5:x+y;} Attempt This Online!
Lua, 98 bytes function(t)r={}for k,v in pairs(t)do r[v]=0 end for k,v in pairs(t)do r[v]=r[v]+1 end return r end Attempt This Online!
JavaScript (Node.js), 60 bytes s=>[/\w+/g,/./g,/[\S\t]/g].map(p=>(v=s.match(p))?v.length:0) Attempt This Online!
Lua 5.4, 62 bytes _,w=s:gsub('%w+',0)_,c=s:gsub('[^\n]',0)_,n=s:gsub('[%g\t]',0) Attempt This Online! Another version, 65 bytes: p={'%w+','[^\n]','[%g\t]'}for i=1,#p do _,r[i]=s:gsub(p[i],'...
Lua 5.4, 76 bytes function(m,n)for i=0,m*n-1 do _=(i%n==0)and print()or io.write(i,' ')end end Try it online!
C (gcc), 37 bytes f(n,p){while(++p*p<n);return p*p==n;} Try it online! The solution is based on the simple fact that: $$\forall n \in \mathbb{N}, n \text{ is a perfect square} \Longleftrig...
Lua 5.4, 9 bytes n^.5%1==0 Try it online! The entire compressed code is 33 bytes: function f(n)return n^.5%1==0 end Try it here. It's not clear whether the rules allow the first form (i...
C (gcc), 35 bytes f(n){return n<2?n:f(n-1)*2+f(n-2);} Try it online!
Lua 5.4.4, 51 bytes function f(n)return n<2 and n or f(n-1)*2+f(n-2)end Try it online!
JavaScript (V8), 78 bytes f=s=>s.map(c=>(_==256||_<0?_=0:0)||c=='i'?_++:c=='d'?_--:c=='s'?_*=_:v+=_+' ') Try it online!