Search
Vyxal/Keg , 8 bytes `:.,`:., Try it online! (Keg) The explanations are the same for both languages, seeing as how Vyxal is heavily based on Keg. Explained `:.,` # Push the string ":.," :., ...
Given an integer n, output the smallest prime such that the difference between it and the next prime is at least n. For example, if n=5, you would output 23, since the next prime is 29, and 29-23&...
Japt -R, 27 22 bytes 27òÈn28 ÇmX27-X-ZøÃÔû Test it Lots of credit goes to xnor for finding the min(i,j,27-i-j) trick. -5 bytes thanks to @Shaggy
Canvas, 19 bytes ‾-{{╷¹²-m‾-¹-m] *]/ Try it here! ‾-{{╷¹²-m‾-¹-m] *]/ Program, ascii-fied for monospacing ‾- push 28 { ] for 1…28 (pushing counter & s...
Raku, 27 bytes {+([\+](1 X/1..*)...*>=$_)} Try it online! { } # Anonymous code block [\+]( ) # Get the partial sum of 1 X/ ...
Japt -x, 6 5 bytes Ë*VpE Try it Ë*VpE :Implicit input of array U and float V Ë :Map each element D at 0-based index E * : Multiply D by VpE : V raised to the pow...
AppleScript, 178 bytes set n to text returned of (display dialog "" default answer "") as number set k to 0 set h to 0 repeat set k to k + 1 set h to h + (1 / k) if h >= n then exit repea...
Python 3, 35 bytes f=lambda x,i=1:x>0and-~f(x-1/i,i+1) Try it online! Subtracts each 1/i in turn from the initial value until the result is no longer positive.
Code Golf seems like a fun idea to me, since I'm a programmer by trade and "language lawyer" nerd as a hobby. But every time I checked the code golf site on SE, I dismissed it as nonsense, because...
Python 2, 13 bytes exec'+1'*5**9 Try it online! No idea why this works. Something in the Python expression parser?
APL (Dyalog Unicode), 10 bytes Full program. Prompts for list of strings from stdin. 0~⍨,⍉↑0,¨⎕ Try it online! ⎕ prompt for list of strings 0,¨ prepend a zero to each ↑ convert to orthogona...
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...
Post tips for Befunge code golf here! This is based on a type of question I used to see on CGCC, where people would post tips for golfing in various languages. They happened to be quite helpful, s...
Scala, 119 bytes Saved 26 bytes after porting Moshi's solution! _ sortBy("y gree br sc bla oc pe rub ol v f li go ch m cre c s ro a l ru g pu w p o b"split " "indexWhere _.startsWith) Original...
Husk, 9 solutions 1. Classic 256 Try it online! 2. Squaring □□4 Try it online! 3. Incrementing →→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→...
Japt, 625 615 bytes `'T°s ߦg, d e sÒy v Did gy d g½e e °¼; A¥ Úßy ØÀ e Þgov, A e Ú ÎÈs tg¼. ` +i` "BeØ e {=`Jab¼rwock`}, my s! T jaws È ßÒ, e claws È ¯t®! BeØ e...
Jelly, 2 bytes ŒṪ Try it online! 1-indexed, but the footer converts to 0-indexed. Less built-in: Jelly, 3 bytes œẹ1 Try it online! œẹ All multidimensional indices of 1 one. ...
Update: we can do this more easily now. We can change the reputation grants per post type per category, both up and down, without creating a new post type. Sandbox posts would continue to use the...
C, 66 59 bytes -7 bytes thanks to Lundin! In-place string reversal f(char*s){s[1]?f(s+1):0;for(char t=*s;s[1];*++s=t)*s=s[1];} Try it online!
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...
Note: This challenge was underspecified and bad, and as such I would not encourage answering it in the future. Challenge You will be given a single 2D boolean array $M$. You may take its dimensi...
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<...
Task Print the following: ABDFHJLNPRTVXZ CABDFHJLNPRTVX ECABDFHJLNPRTV GECABDFHJLNPRT IGECABDFHJLNPR KIGECABDFHJLNP MKIGECABDFHJLN OMKIGECABDFHJL QOMKIGECABDFHJ SQOMKIGECABDFH USQOMKIGE...