Search
JavaScript (Node.js), 153 147 bytes -6 bytes thanks to Shaggy! a=>a.sort((x,y)=>g(x)-g(y),g=x=>"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` `.find...
Brachylog, 16 bytes g₂;.z∋zbᵗ×ᵐ/ℤ↰|w Try it online! This is a function submission, which inputs n from the left and A from the right (as a list of two-element lists). Output is to standard out...
Japt, 3 bytes e¡g Try it e¡g :Implicit input of array U e :Is equal to ¡ :Map U g : First element of U
APL (Dyalog Unicode), 3 bytes ⍋≡⍒ Try it online! ⍋ computes the permutation vector that would sort the argument into ascending order ⍒ computes the permutation vector that would sort the ar...
Instead of the code-golf-tips tag, could we tag "Tips for golfing" questions with tips and code-golf instead? They can still be searched for, so I don't see a reason to make a special tag to repres...
In this request (not really a feature-request but still tagged so anyway), I'd like to have detailed wikis on tags and maybe usage information on them too. Currently, these tags have usage info in...
Rockstar, 76 bytes Takes individual integers as input. listen to f let n be f o's1 while n let o be o and n is f listen to n say o Try it (Code and input will need to be added manually...
Japt, 610 606 bytes Don't think there's anything more that can be done with it than this. 933î`'T°s ߦg, d e sÒy v Did gy d g½e e °¼; A¥ Úßy ØÀ e Þgov, A e Ú ÎÈs tg¼.0"BeØ ...
Ruby, 17 bytes ->{_2.reduce(_1)} Takes function (Proc) followed by Array. 32 bytes without inject or reduce ->f,(a,*r){r.map{|n|a=f[a,n]};a}
JavaScript (Node.js), 27 22 bytes -5 bytes thanks to Hakerh400 Direct computation f=n=>(n+(n*n+4)**.5)/2 $$\frac{n+\sqrt{n^2+4}}{2}$$ 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!
V (vim), 23 bytes æw|PòlÄxòjVLkîyllv$r $Ð Try it online! Hexdump: 00000000: e677 7c50 f26c c478 f26a 564c 6bee 796c .w|P.l.x.jVLk.yl 00000010: 6c76 2472 2024 d0 lv$r ...
Currently, the only purpose a link to a SE account serves is to associate imported content with your CD account. Since Code Golf doesn't have any imported content from SE, there's no option to link...
Scala, 9 bytes _.reverse Try it in Scastie! Explanation: _.reverse _ //The function argument . //Call a method reverse //Reverse the string
Scala, 99 bytes s=>{val x=s+s.reverse s(0)+"\n"+x.tail.init.zipWithIndex.map{case(c,i)=>c+" "*i+c+"\n"}.mkString+x} Try it in Scastie!
PowerShell, 43 bytes param($s)(($s=$s|% t*y)|%{$s[--$q]})-join'' Try it online!
Jelly, 4 bytes ¹Ƥċ" Try it online! " For each element of the input, ċ how many times does it occur in ¹Ƥ " the corresponding prefix of the input?
APL (Dyalog Unicode), 11 bytes (SBCS) 1 1∘⍉+\∘.=⍨ Try it online! This was a fun APL exercise. Working on figuring out how to get it down to 7 bytes.
Exploiting layout Make it thin Newlines and indentation are expensive, so remove them when possible. Some examples: &v factorial v< > >:1-:| v* < >$>\:| ...