Search
JavaScript (Node.js), 892 bytes (not fully working) I=>{N=a=>Math.min(...a);X=a=>Math.max(...a) C=[];s=[t=[],[]];S="splice";p="push" c=I[P="map"](a=>a[P](p=>p-N(a))) d=X(c[1])-X(...
A program may use IOs for input and output. A input can be read via IO, which can be a port with (multiple) IOs each IO reads a symbol (a bit or more when you have a ADC). Or it can come from fram...
Python, 143 bytes def r(i): y,z=65537,1+(1<<32);s=257*y*z;n=(i|(i&252*s)*y>>10|(i&254*s)*z>>17|(i&127*s)*z>>15|(i&63*s)*y>>6)&(1<<64)-1 ...
Brainfuck, 10 Bytes ,[>,]<[.<] Requires EOF to be 0. Try it online! ,[>,]<[.<] , # Read character [ ] # loop as long as current cell is not 0 (EOF) >, ...
R, 32 bytes \(s)intToUtf8(rev(utf8ToInt(s))) Attempt This Online!
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), 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, 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!
MATL, 8 bytes tp:qwPe! Try it online! tp:qwPe! t : duplicate with implicit input (function args as array) p : product [2 3]p -> 6 : : range 1..n q : decremen...
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],'...
JavaScript (Node.js), 60 bytes s=>[/\w+/g,/./g,/[\S\t]/g].map(p=>(v=s.match(p))?v.length:0) Attempt This Online!
Wolfram Language (Mathematica), 70 bytes {Tr[1^StringSplit@#],StringLength@#,StringLength@StringDelete[#," "]}& Try it online! What made me decide to use Mathematica for string processing?...
Python 3.8, 73 bytes lambda x:[len(x.split()),len(x.replace('\n','')),len(''.join(x.split()))] Try it online!
J, 17 char +/`5:@.(2*./@:=]) How it works: What's within parentheses tests if both numbers on the right are 2. If so, the verb agenda @. selects the verb 5: which is always 5. If not, the ve...
J, 30 char ((2*%:2)%~(1+%:2)&^-(1-%:2)&^) ((2*%:2)%~(1+%:2)&^-(1-%:2)&^) 0 0 ((2*%:2)%~(1+%:2)&^-(1-%:2)&^) 1 1 ((2*%:2)%~(1+%:2)&^-(1-%:2)&^) 2 2 ...
J, 46 char ({.(+/m)#a),{:(+/"1 m=:x=+/~a)#a=:p:i._1 p:x=: Sample runs ({.(+/m)#a),{:(+/"1 m=:x=+/~a)#a=:p:i._1 p:x=:4 2 2 ({.(+/m)#a),{:(+/"1 m=:x=+/~a)#a=:p:i._1 p:x=:6 3 3 ({.(+/m)#a),{:...
J, 5 char 2>#~. How it works: '~.' produces list of unique elements of list on its right '#' counts how many elements in the list on its right '2>' tests if number on its right only ha...
J, 7 char '+/',": Sample runs: '+/',": 6 +/6 +/6 5 11 '+/',": 55 +/55 +/55 45 100
J, 36 char {._2{(}.,~(=<.)@v{.@#v=.}.*{.)^:(<_) Sample runs: {._2{(}.,~(=<.)@v{.@#v=.}.*{.)^:(<_) 1096135733 78r55 5r3 1r5 11r2 5r7 328842888196762472689573703 {._2{(}.,~(=...
J, 29 char ('!',~'Hello, ',1!:1<1)1!:2<4 Sample run ('!',~'Hello, ',1!:1<1)1!:2<4 torres Hello, torres!
J, 46 char 'ABCDE'{~<:0 128 192 224 240 I.>:".{.}.;.1'.', Sample runs 'ABCDE'{~<:0 128 192 224 240 I.>:".{.}.;.1'.', '127.255.255.255' A 'ABCDE'{~<:0 128 192 224 240 I...
C (gcc), 358 bytes static inline _Noreturn float f(union u);extern _Thread_local _Complex long double*restrict B;main(void){_Atomic register enum {A};typedef _Alignas(unsigned char)struct S;_Sta...