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
 
60%
+1 −0
Challenges Caesar shift cipher

Lean 4, 183 181 bytes def c(t:String)(s:Nat):String:=t.map (λc=>if Char.isAlpha c then let b:=if Char.isLower c then 'a'else 'A';let h:=(Char.toNat c-Char.toNat b+s)%26+Char.toNat b;Char.ofNat ...

posted 2mo ago by CrSb0001‭  ·  edited 2mo ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Prove commutativity on this monoid presentation.

Python 3.8, 64 bytes lambda s,_:((n:=s.count("1"))*"1"+"0"+n*"1010")*(len(s)-n)+n*"1" Try it online! Let Tn consist of (2n+1) 0s and 2n 1s alternating. Tn can consume a 1 on either side and ...

posted 2mo ago by m90‭

Answer
60%
+1 −0
Challenges Bytes to Segfault

x86 machine code, 3 bytes 31 FF AB Try it online! In assembly: xor edi, edi stosd Set EDI to 0 by XORing it with itself, then use the 1-byte stosd instruction to try to write EAX to tha...

posted 2mo ago by m90‭

Answer
60%
+1 −0
Meta Estimating demand for challenge types

Most challenges are code golf. Apart from being the name of the community, code golf is also easier to write both answers and challenges for (while a lot of time and effort can go into golfing, wri...

0 answers  ·  posted 2mo ago by trichoplax‭  ·  edited 2mo ago by trichoplax‭

Question discussion
60%
+1 −0
Challenges Prove commutativity on this monoid presentation.

x86-64 machine code, 37 bytes 31 C0 50 50 FF 04 C4 AC 2C 30 79 F8 5A 48 B8 31 30 31 30 AE 51 F3 AB 59 51 F3 AA 88 27 59 FF CA 75 F1 88 17 C3 Try it online! Following the standard calling conve...

posted 2mo ago by m90‭  ·  edited 2mo ago by m90‭

Answer
60%
+1 −0
Challenges Integer to Roman numeral

Vyxal, 12 bitsv2, (actually 1.5 but the leaderboard needs to say) 2 bytes øṘ Try it Online! Bitstring: 000101111100 Very simple: call the built-in :p

posted 1mo ago by lyxal‭

Answer
60%
+1 −0
Challenges Cumulative Counts

Python 3, 50 bytes We can simply omit the lambda name since we don't refer to it anywhere in the lambda definition. lambda l:[l[:i+1].count(j)for i,j in enumerate(l)] Example usage in the term...

posted 2mo ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Cumulative Counts

Lean 4, 111 97 bytes def d(l:List Nat):=((λx=>(l.reverse.drop x).count l.reverse[x])<$>(List.range l.length)).reverse Try it online! Given how verbose Lean syntax is, and how you can'...

posted 2mo ago by CrSb0001‭  ·  edited 20d ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Caesar shift cipher

Python 3, 86 85 bytes The reasoning behind why this works is basically that 1. we can directly compare the ordinal values of characters (apparently) and 2. we only need that if a character is alph...

posted 2mo ago by CrSb0001‭  ·  edited 2mo ago by CrSb0001‭

Answer
60%
+1 −0
Challenges Expand a greyscale/colour hex code

Q/KDB+, 39 bytes {"#",?[4=count x;x 1 1 2 2 3 3;6#1_x]} Testing the function: q)cc:{"#",?[4=count x;x 1 1 2 2 3 3;6#1_x]} q)cc "#ABCDEF" "#ABCDEF" q)cc "#A" "#AAAAAA" q)cc "#AB" "#ABABAB...

posted 5mo ago by Arpad Horvath‭  ·  edited 5mo ago by Arpad Horvath‭

Answer
60%
+1 −0
Challenges Abstract Rewriting Systems (Cops)

This is somewhat of a [proof-golf]-like [cops-and-robbers]. This is the cops' thread; the robbers' thread is here Sections: Cops Scoring What is a rewrite rule? An example An example of...

1 answer  ·  posted 7mo ago by CrSb0001‭  ·  last activity 6mo ago by CrSb0001‭

Question cops-and-robbers repeated-transformations grammars
60%
+1 −0
Challenges Make $2 + 2 = 5$

BQN (CBQN), 9 bytes ++2⊸=∧=⟜2 This utilizes the "3-train"- any functions in the form w fgh x is turned into (w f x) g (w h x). In this case, 2⊸= and =⟜2 are functions that check if the right a...

posted 7mo ago by arutonee‭

Answer
60%
+1 −0
Challenges Partial Sums of Harmonic Series

Vyxal, 7 bytes ɾĖ∑?≥)ṅ Try it Online! Vyxal has arbitrary-precision rationals, so this will never run into precision errors. ṅ # Find the first integer -----) # where ∑ # sum of...

posted 7mo ago by emanresu A‭

Answer
60%
+1 −0
Challenges Find the IP address class

C (gcc), 55 bytes a;f(char*s){for(;atoi(s)&128>>a&&a<4;a++);return 65+a;} Try it online! Just call atoi and start masking with 0x80. If true, keep looping and next che...

posted 7mo ago by Lundin‭  ·  edited 6mo ago by Lundin‭

Answer
60%
+1 −0
Challenges Find all unique quintuplets in an array that sum to a given target

Inspiration: Leetcode's [3Sum] linkLink on CG&CC Problem Given an array nums of n (not necessarily distinct) integers, and given a target number target, return an array of all of the unique...

2 answers  ·  posted 6mo ago by CrSb0001‭  ·  last activity 3mo ago by panadestein‭

Question code-golf array arithmetic
60%
+1 −0
Challenges Borromean coprimes

Python, 89 Bytes import math as m def f(*n):return m.gcd(*n)==1and all(m.gcd(a,b)!=1for a in n for b in n) Note: The outdated Python interpreter at tio.run won't run this code (nor the ungolfe...

posted 5mo ago by celtschk‭

Answer
60%
+1 −0
Challenges Expand a greyscale/colour hex code

Haskell + hgl, 32 24 bytes tlM$tk6<cy<fiI(rl2~<)eL3 Explanation tlM map a over the tail of the input ... fiI if ... el3 the length is 3 (rl2~<) repeat each letter in place twi...

posted 5mo ago by WheatWizard‭  ·  edited 5mo ago by trichoplax‭

Answer
60%
+1 −0
Challenges Digit balanced numbers

Vyxal 3, 2 bytes ⊞≈ Vyxal It Online! Shortest you'll probably get barring fractional bytes. Explained ⊞≈ ## Input is a number ⊞ ## Counts of all items in the number ≈ ## Are they all the...

posted 3mo ago by lyxal‭

Answer
60%
+1 −0
Challenges Expand a greyscale/colour hex code

APL (Dyalog Classic), 31 bytes '#',{4=≢⍵:⍵[2 2 3 3 4 4]⋄6⍴1↓⍵} Try it online!

posted 5mo ago by Arpad Horvath‭  ·  edited 5mo ago by Arpad Horvath‭

Answer
60%
+1 −0
Challenges Expand a greyscale/colour hex code

Japt, 13 12 bytes Î+6îUÅË+pUÊv Try it (includes all test cases) Î+6îUÅË+pUÊv :Implicit input of string U Î :First character + :Append 6î : M...

posted 5mo ago by Shaggy‭  ·  edited 5mo ago by Shaggy‭

Answer
60%
+1 −0
Challenges Borromean coprimes

BQN, 27 bytes •math.GCD{∧´∘⥊(1=𝔽´)∧1<𝔽⌜˜} Booleans in BQN are the integers 0‿1. Try all test cases on the: BQN online REPL

posted 3mo ago by panadestein‭  ·  edited 3mo ago by panadestein‭

Answer
60%
+1 −0
Challenges Partial Sums of Harmonic Series

BQN, 23 bytes {𝕩{𝕊⍟(𝕗>·+´∘÷1+↕)𝕩+1}1} This recursion is more complicated than it should, but I managed to keep it purely functional. I use a modifier to mimic passing a left argument, that's...

posted 3mo ago by panadestein‭

Answer
60%
+1 −0
Challenges Digit balanced numbers

Vyxal, 4 bytes Ċvt≈ Try it Online! Outputs 1 for true, 0 for false. The footer is to convert the output to the provided test case format. Explained Ċvt≈­⁡​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁢‏⁠‎⁡⁠...

posted 3mo ago by lyxal‭

Answer
60%
+1 −0
Challenges Find all unique quintuplets in an array that sum to a given target

BQN, 31 bytes {⍷(+´⊸=⟜𝕩∧5=≠)¨⊸/⥊(↕2¨𝕨)/¨<∧𝕨}´ This block function returns the empty array ⟨⟩ if the conditions cannot be satisfied. It works by sorting the input list to prevent having to fi...

posted 3mo ago by panadestein‭

Answer
60%
+1 −0
Challenges Expand a polynomial

BQN, 15 bytes ⊢(«∘⊢-×)´˜1∾˜≠˜ A 3-train (fold with initial): we zero list of the same length as the input with a one appended (the base case), then for each root we do the multiplication by the...

posted 3mo ago by panadestein‭

Answer