Skip to main content
Share Your Experience: Take the 2024 Developer Survey

New answers tagged

0 votes

Don't google "google"

C (gcc), 61 bytes int f(char*x){return"\0"[!strcmp(x,"google")<<31]+strlen(x);} Try it online! Not a very great answer. If the string is ...
None1's user avatar
  • 811
1 vote

Is this a solvable Numberlink?

JavaScript (ES7), 142 bytes Expects a matrix of integers with 0's for empty cells. Returns 0 or 1. ...
Arnauld's user avatar
  • 193k
0 votes

List of primes under a million

AWK, 58 bytes {for(;i++<$0;){for(j=x=1;j<i;)i%++j?J:x++;if(2~x)print i}} Try it online! Will work for arbitrary amount: ...
C K's user avatar
  • 61
0 votes

Print the Christmas alphabet

Arturo, 24 bytes print join--@`a`..`z``l` Try it!
chunes's user avatar
  • 24.2k
1 vote

Is this a solvable Numberlink?

Python 3.8 (pre-release), 186 bytes ...
Jitse's user avatar
  • 7,196
1 vote

Cold Bee and Old Beer

Brachylog, 15 bytes {⊇Ċp.bʰkᵗ∈ᵛ?∧}ᶠ Try it online! Explanation ...
Fatalize's user avatar
  • 38.7k
0 votes

Quickly regrouping lists

Arturo, 50 bytes $->a[0while->¬one? a[a:chunk a=>[&]|map=>size+1]] Try it! Explanation ...
chunes's user avatar
  • 24.2k
0 votes

Output with the same length as the code

Befalse (quirkster), 8 bytes :::: 9.; Try it! Prints eight tab characters. 9. is the "loop body", and the leading <...
Bubbler's user avatar
  • 76.8k
2 votes

Cold Bee and Old Beer

Ruby, 58 bytes ->w{w.permutation(2).select{|a,b|[a[1..-1],b.chop]-w==[]}} Try it online!
G B's user avatar
  • 22k
1 vote

Print the Christmas alphabet

JavaScript, 67 bytes _=>Array.from({length:25},(_,x)=>(x+10+(x>10)).toString(36)).join`` Try it online!
darrylyeo's user avatar
  • 7,897
2 votes

Implement a Truth-Machine

Befalse (quirkster), 12 bytes ,!/$.$1! &?/ Try it! ...
Bubbler's user avatar
  • 76.8k
1 vote

Find the indices of values in one list in another

Java, 32 bytes n->m->n.stream().map(m::indexOf) Returns a 0-indexed Stream of Integer...
Unmitigated's user avatar
  • 2,759
1 vote

Find the indices of values in one list in another

Nibbles, 4 nibbles (2.0 bytes) .$?_ Uses 1-based indices. Attempt This Online! Explanation ...
DLosc's user avatar
  • 39.5k
0 votes

Print the Christmas alphabet

Nibbles, 9 nibbles (4.5 bytes) -|@\$u"L" Attempt This Online! Explanation Inspired by Mike Bufardeci's Nibbles answer, but since most of it is different ...
DLosc's user avatar
  • 39.5k
0 votes

Interpret PlusOrMinus

PowerShell Core, 41 bytes switch($args){+{$c++}-{[char]($c--%256)}} Try it online! Function that takes a string using splatting Returns an array of characters
Julian's user avatar
  • 3,058
0 votes

Complete the grid-filling meander

Python3, 1171 bytes Long, but fast. ...
Ajax1234's user avatar
  • 7,211
0 votes

Print the Christmas alphabet

brainfuck, 186 162 bytes -24 bytes from managing data a little bit better ...
madeforlosers's user avatar
0 votes

Construct a uInt from an array of bits

Perl 5 -p, 12 bytes $_=oct"0b$_" Try it online!
Xcali's user avatar
  • 15.1k
0 votes

Construct a uInt from an array of bits

dc, 4 bytes 2i?p Reads an array of 0 or 1 chars from stdin. Try it online!
Digital Trauma's user avatar
1 vote

Find the indices of values in one list in another

AWK, 80 bytes {ORS="";split($1,n,"");split($2,m,"");for(i in n)for(j in m)print n[i]~m[j]?j:X} Try it online! Example: ...
C K's user avatar
  • 61
-1 votes

Complex Exponentiation

Python 3, 89 bytes import math e=lambda a,b,c,d:math.e**((c+1j*d)*(math.log(a**2+b**2)/2+1j*math.atan2(b,a))) Try it online
dr.me123's user avatar
1 vote

Complex Exponentiation

Python + numpy, 115 bytes -9 bytes thanks to corvus_192 ...
Stef's user avatar
  • 899
1 vote

Interpret PlusOrMinus

brainfuck, 65 57 bytes >,[>--[++++++<->]+<[--[[-]>-<]>[<<.->>-][-]<]>[-<<+>>]<,] Try it online!
matteo_c's user avatar
  • 6,360
2 votes

Cold Bee and Old Beer

R, 76 bytes \(W,`?`=\(i)W[substr(W,2-i,nchar(W)-i)%in%W],x=merge(?0,?1))x[x[,1]!=x[,2],] Attempt This Online! The final filtering condition looks ugly to me, but I ...
pajonk's user avatar
  • 16.2k
1 vote

Complex Exponentiation

Python, 107 bytes lambda a,b,c,d:[g(c*(p:=atan2(b,a))+d*log(h:=hypot(a,b)))*h**c/exp(d*p)for g in[cos,sin]] from math import* Attempt This Online! A port of ...
corvus_192's user avatar
  • 5,304
2 votes

Cold Bee and Old Beer

Arturo, 55 bytes $->_[permutate.by:2_|select'p->_⊃@[drop p\0chop p\1]] Requires modern Arturo, hence the online playground won't run this yet. Here's a ...
chunes's user avatar
  • 24.2k
1 vote

Find the indices of values in one list in another

Arturo, 25 bytes $[n,m]->map n=>[index m&] Try it
chunes's user avatar
  • 24.2k
2 votes

Tips for golfing in C++

If you have some variables declared in a row : int a,b,c,d; You can access b by (&a)[1], or c by (&a)[2] ... It can be interesting there : ...
Rémi's user avatar
  • 41
2 votes

Tips for golfing in C

If you have some variables declared in a row : int a,b,c,d; You can access b by (&a)[1], or c by (&a)[2] ... It can be interesting there : ...
Rémi's user avatar
  • 41
2 votes

Complex Exponentiation

Google Sheets, 87 bytes Expects \$a\$, \$b\$, \$c\$, \$d\$ in \$A1\$, \$B1\$, \$C1\$, \$D1\$ respectively and it returns the result in two horizontally adjacent cells. ...
z..'s user avatar
  • 553
0 votes

Don't google "google"

Acc!!, 123 bytes -1 Count i while _/256^i { _+N*256^(i+1)+1 } _%256+0/(_/256-2926266033336167) Write _/100+48 Write _/10%10+48 Write _%10+48 Try it online! (Note: ...
engineer gaming's user avatar
3 votes

"Hello, World!"

Lazy K, 564 bytes ...
Esolanging Fruit's user avatar
1 vote

Covfefify a string

Acc!!, 257 bytes ...
engineer gaming's user avatar
2 votes

Cold Bee and Old Beer

Perl 5 -a, 84 bytes $"=',';map{/(.(.*)),((.*).)/;say if$1ne$3&&(grep$2eq$_,@F)*grep$4eq$_,@F}<{@F},{@F}> ...
Xcali's user avatar
  • 15.1k
4 votes

Complex Exponentiation

JavaScript (ES7), 94 bytes Returns [real, img]. This is essentially the formula used by doubleunary, except I'm computing \$\sqrt{a^2+b^2}\$ (with ...
Arnauld's user avatar
  • 193k
4 votes

Complex Exponentiation

Google Sheets, 91 bytes =let(s,A1^2+B1^2,a,atan2(A1,B1),r,s^(C1/2)/exp(D1*a),u,C1*a+D1*ln(s)/2,{r*cos(u),r*sin(u)}) Put the four coefficients in cells ...
doubleunary's user avatar
  • 1,707
0 votes

A Turtle Finds a Portal

Python3, 319 bytes ...
Ajax1234's user avatar
  • 7,211
0 votes

Compute the degree of a string

AWK, 113 bytes ...
C K's user avatar
  • 61
0 votes

Escape the Candlelit Maze

Python3, 351 bytes ...
Ajax1234's user avatar
  • 7,211
3 votes

Complex Exponentiation

APL (Dyalog Unicode), 87 bytes Anonymous prefix lambda taking [a,b,c,d] and returning [x,y] for \$x+yi\$. ...
Adám's user avatar
  • 30.3k
3 votes

Cold Bee and Old Beer

Haskell, 54 bytes f w=[[x,y]|x<-w,y<-w,x/=y,elem(tail x)w,elem(init y)w] Attempt This Online!
matteo_c's user avatar
  • 6,360
5 votes

Cold Bee and Old Beer

Jelly, 11 bytes œ!2ḊṖƭ€fƑ¥Ƈ Try it online! Don't love resorting to ƭ for this. ...
Unrelated String's user avatar
3 votes

Cold Bee and Old Beer

Charcoal, 34 32 bytes WS⊞υιFυEΦυ¬∨⁼ικ⁻⟦Φιν✂κ⁰±¹⟧υ⁺⁺ι κ Try it online! Link is to verbose version of code. Explanation: WS⊞υι ...
Neil's user avatar
  • 171k
4 votes

Cold Bee and Old Beer

Python 3, 59 bytes lambda d:[[i,j]for i in d for j in d-{i}if{i[1:],j[:-1]}<d] Try it online!
Mukundan314's user avatar
  • 11.9k
1 vote

Cold Bee and Old Beer

JavaScript (Node.js), 77 bytes f=(x,a)=>x.flatMap(b=>a!=b&x.includes(b.slice(!a,a&&-1))?a?[[a,b]]:f(x,b):[]) Try it online! -3B from Arnauld
l4m2's user avatar
  • 24.4k
7 votes

Compute the degree of a string

Cubical Agda, 1134 bytes Uses Agda 2.6.4.3, the cubical library 0.7 and the standard library 2.0. ...
Naïm Favier's user avatar
0 votes

Indexable quine

Lenguage, 4 x 0.75 = 3 bytes 00 00 00 00 Equivalent to Brainfuck ., outputting byte 0
l4m2's user avatar
  • 24.4k
1 vote

Hoop, Hoop, Hoop, Hoop, Eye-Eye-Eye-Eye

05AB1E, 21 18 bytes [D_#<T‰`ˆ}TÞ¯R>×JC Port of @Neil's Charcoal answer, so make sure to upvote that answer as well! -3 bytes thanks to @Neil For a language ...
Kevin Cruijssen's user avatar
2 votes

Interpret brainfuck

Acc!!, 678 652 bytes -26 bytes thanks to @Mukundan314 ...
engineer gaming's user avatar
1 vote

Compute the degree of a string

05AB1E, 9 bytes Ç¥>3%<O3÷ Attempt This Online! ...
alephalpha's user avatar
  • 48.2k

Top 50 recent answers are included