Search
Japt, 9 bytes All credit to ETH on this one. 9îQi"9îQi Test it 9î :Repeat the following to length 9 Q : Quotation mark i"9îQi : Prepend "9îQi" And, for th...
JavaScript, 29 bytes f=(n,x=0)=>n>0?f(n-1/++x,x):x Try it online!
APL (Dyalog Unicode), 22 bytes ⎕←∘.((1+⍳9)⌽⍨⊣+3×⊢)⍨⍳3 Try it online! Requires zero-indexing. ⎕←∘.((1+⍳9)⌽⍨⊣+3×⊢)⍨⍳3 ⍳3 ⍝ Make the range [0, 2] (row and cols of 3×3 box...
C (gcc), 20 bytes f(a){puts("!"+a%2);} Try it online! Function solution. Prints ! in case of even numbers, otherwise just new line.
h, 4 bytes 1,-1 Neither this program (by VilgotanL) nor the language (by Nerdaxe) are mine, but I think the latter is interesting and so I am submitting the former. Step-by-step guide: Accumu...
Ruby, 8 bytes ->n{n%2} Generic mod-in-a-lambda solution. Alternately, for 2.7+: ->{_1%2} Try it online!
MAWP, 8 bytes @!2P2WA: Try it! 1 for odd and zero for even. mawp doesn't have modulus, so it floor divides by 2, multiplies by 2 and subtracts from the input.
Make the Server Fault logo using the following criteria: The boxes' measurements: There are 3 columns of 5 boxes, with long ones at the left where the rest are regular. The following measure...
C (compliant), 106 bytes char r,i,s[80];void f(int n){memset(s,32,79);for(;r<n;puts(s),r++)for(i=0;i++<n*2;s[n-r-1]=47,s[n+r]=92);} Try it online! Standard C compliant function solutio...
C (gcc), 153 bytes a,b;f(char*s){for(char*c,*o="idso";*s;s++)for(c=o;*c;c++)*s==*c&&(b=c-o,a+=!b,a-=b==1,b==2?a*=a:0,b==3&&printf("%d%c",a,s[1]?44:10),a==-1|a==256?a=0:0);} Tr...
Japt -h, 12 bytes à kÈäÎdÄÃmÊñ Try it à kÈäÎdÄÃmÊñ :Implicit input of array à :Combinations k :Remove elements that return true È :When pass...
I suggest we have some status tags for Sandbox. In particular, one like "status-finalized" instead of manually (and therefore inconsistently and not searchable) changing the title to say "[FINALIZE...
C (compliant), 197 198 bytes. Golfed version of the function in the question, using X macros: #define L Y(1000,M)Y(900,CM)Y(500,D)Y(400,CD)Y(100,C)Y(90,XC)Y(50,L)Y(40,XL)Y(10,X)Y(9,IX)Y(5,V)Y(4,I...
Perl 5 -pMRoman, 10 bytes (17 if including command-line switches) $_=Roman$_
APL (Dyalog Unicode), 110 67 bytes {(⍕((f⊖⍪'AEBFCGDAEBFD'),r⌽12↑¯6↑5⍴'-')⍳2↑⍵),⎕a⌷⍨1+0≠f←¯3+r←3×'i'∊⍵} -43 bytes from dzaima. Requires input exactly as shown in the diagram. A bit fiddly with...
For this to work, I think we need to rule out all start-up code (the C runtime) but also the register maps. So I think answers should be a void main (void){ ... } (or equivalent) function solution ...
Stax, 5 bytes òP^↓Φ Run and debug it Same idea as Quintec's answer. Input as a floating point number. Explanation 1gpun+ 1 start with 1 gp apply the following till a fixpoint...
What general tips do you have for golfing in Scala? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala (e.g. "remove comments" i...
Making a function with val can be shorter than with a def If you're pattern matching, you can use Scala's special syntax and omit match when assigning an anonymous function to a val. As you can se...