Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Search

Advanced Search Options

To further refine your search, you can use additional qualifiers such as score:>0.5. For example, the search score:>=0.5 created:<1y grammar would return only posts mentioning "grammar" that have a score >= 0.5 and were created less than a year ago.

Further help with searching is available in the help center.

Quick hints: tag:tagname, user:xxx, "exact phrase", post_type:xxx, created:<N{d,w,mo,y}, score:>=0.5

Filters
1.6k posts
 
66%
+2 −0
Q&A Tips for golfing in C

Use pointer arithmetic and \0 with string literals In C, strings are just zero-terminated character arrays, which means you can play tricks with pointer arithmetic. For example, the line char*s=a...

posted 3y ago by celtschk‭

Answer
66%
+2 −0
Challenges Implement Rule 110

JavaScript (Node.js), 160 bytes (r,d,n,l=r.length,s=d.length,p=(n,i)=>n?"01110110"[4*p(--n,i-1)+2*p(n,i)+1*p(n,i+1)]:i>=0&i<s?d[i]:r[(i%l+l)%l])=>[...Array(4*l+s+2*n)].map((_,i)=...

posted 3y ago by Moshi‭  ·  edited 3y ago by Moshi‭

Answer
66%
+2 −0
Challenges Find the IP address class

Vyxal, 24 bytes \.€hEb:L8-0wẋf$J0ḟkA5Ẏ$i Try it Online! This is absolutely abysmal but whatever. A lot of bytes are taken up by trying to pad the list with zeroes (ẋ was buggy or something so ...

posted 3y ago by user‭  ·  edited 3y ago by user‭

Answer
66%
+2 −0
Sandbox Create a finite projective plane of order $n$

posted 3y ago by user‭  ·  edited 3y ago by user‭

Article code-golf math
66%
+2 −0
Challenges Find the IP address class

Python 3, 56 bytes lambda x:chr(65+f'{int(float(x[:3]))&~8:08b}'.find('0')) Try it online! Takes in the ip address as a string and returns the classification letter. Explanation: x[:...

posted 3y ago by dino‭  ·  edited 3y ago by dino‭

Answer
66%
+2 −0
Challenges Operation "Find The Operator"

Ruby, 58 bytes Simple eval solution. Using ** for exponentiation. ->a,b,c{%w[+ - * / % **].select{eval("#{a}#{_1}#{b}")==c}} Attempt This Online!

posted 3y ago by snail_‭

Answer
66%
+2 −0
Challenges Determine whether an integer is square-free

Ruby, 27 bytes ->n{(2..n).all?{n%_1**2>0}} Try it online

posted 3y ago by radarek‭  ·  edited 3y ago by radarek‭

Answer
66%
+2 −0
Challenges Multiply complex numbers.

Ruby, 25 bytes ->e{e.to_c*e[/ .*/].to_c} Try this online!

posted 3y ago by radarek‭

Answer
66%
+2 −0
Challenges Given the preorder and the inorder of a tree, output the postorder

Ruby, 75 72 bytes f=->((e,*r),n){(i=n.index e)?f[r[0,i],n[...i]]+f[r[i..],n[i+1..]]+[e]:n} Attempt This Online!

posted 3y ago by radarek‭  ·  edited 3y ago by radarek‭

Answer
66%
+2 −0
Challenges Stairs? Stairs! Stairs.

Ruby, 50 bytes ->n{n.times{puts (' '*(n-_1)+'_/'+'##'*_1)[3..]}} Attempt This Online!

posted 3y ago by radarek‭

Answer
66%
+2 −0
Challenges Keyword golfing

Scala 3, 553 bytes package a import E.Z as Z import E.* sealed trait T open class Y{export E.Z as Q} enum E[+A]derives CanEqual: case Z end E private abstract final class X extends AnyRef...

posted 3y ago by user‭

Answer
66%
+2 −0
Challenges Can you give me half?

JS, 15 bytes !![]/(-~[]-~[]) Basically typed random characters into js console and it worked.

posted 3y ago by ChiefChippy2‭  ·  edited 3y ago by Razetime‭

Answer
66%
+2 −0
Challenges Can you give me half?

Javascript, 5 Distinct characters, 9 Bytes ~[]/~-~[]

posted 3y ago by AkshatJ‭  ·  edited 3y ago by AkshatJ‭

Answer
66%
+2 −0
Challenges Can you give me half?

Japt, 1 byte ½ Test it Jelly, Vyxal, 1 byte . Try it online! Yeah, golf langs still kind of kill this challenge.

posted 3y ago by Quintec‭

Answer
66%
+2 −0
Challenges Can you give me half?

Scala, 15 bytes '#'.toFloat/'F' Try it in Scastie! Characters in Scala kinda get casted to integers. This is usually annoying, but it's useful when golfing. # is 35 and F is 70, and the .toFlo...

posted 3y ago by user‭

Answer
66%
+2 −0
Challenges Can you give me half?

Raku (also Perl polyglot), 5 unique, 13 bytes !()/(!()+!()) () or empty list coerces to its length which is 0 in math operations and !0 is True which coerces to 1

posted 3y ago by Hydrazer‭  ·  edited 3y ago by Hydrazer‭

Answer
66%
+2 −0
Challenges Can you give me half?

Ruby, 10 distinct, 35 chars t=/%/=~%/=%/ o=/%/=~%/==%/ t/o.to_f

posted 3y ago by sampersand‭

Answer
66%
+2 −0
Challenges Can you give me half?

Julia 1.0, 16 bytes (o=one(Int))/-~o Try it online!

posted 3y ago by amz‭  ·  edited 3y ago by amz‭

Answer
66%
+2 −0
Challenges Can you give me half?

J, 4 unique, 4 char -:=_ How it works: -: results in half of what's on the right = results in signum of what's on the right _ is infinity

posted 3y ago by torres‭  ·  edited 2y ago by torres‭

Answer
66%
+2 −0
Challenges Keyword golfing

Ruby 3.1.0, 274 259 249 bytes -10 bytes thanks to Paradox in the Ruby discord BEGIN{END{alias module class begin rescue retry ensure end if self elsif defined? for$.in true do super while f...

posted 2y ago by south‭  ·  edited 2y ago by south‭

Answer
66%
+2 −0
Challenges Looping counter

brainfuck, 31 bytes ++++++++++[[>]>-[<+>---]<[.<]>] Try it online!

posted 2y ago by orthoplex‭

Answer
66%
+2 −0
Challenges Looping counter

Haskell, 35 bytes main=mapM putStrLn$iterate('*':)"*" Attempt This Online! 55 -> 39, with orthoplex's idea. 39 -> 35 from orthoplex.

posted 2y ago by Razetime‭  ·  edited 2y ago by Razetime‭

Answer
66%
+2 −0
Challenges Write a Deadfish Interpreter

Lua 5.4.4, 99 bytes _=0s:gsub('.',function(c)_=({d=_-1,i=_+1;s=_*_})[c]or print(_)or _ _=({[256]=0,[-1]=0})[_]or _ end) Try it online! Thanks to @orthoplex for more shortening.

posted 2y ago by Zakk‭  ·  edited 2y ago by Zakk‭

Answer
66%
+2 −0
Challenges Looping counter

MATL, 16 bytes 1`1yh1$lZctDwQt] Try it online! The TIO output fetch will likely fail, so make sure to click the run button to stop the execution. 1`1yh1$lZctDwQt] 1` ] - Push 1 o...

posted 2y ago by south‭

Answer
66%
+2 −0
Challenges Find near miss prime multiples.

Given a number $n \geq 3$ as input output the smallest number $k$ such that the modular residues of $k$ by the first $n$ primes is exactly $\{-1,0,1\}$. That is there is a prime in the first $n$ p...

0 answers  ·  posted 1y ago by WheatWizard‭  ·  edited 1y ago by WheatWizard‭