Search
Python 3, 10 bytes 1 .__and__ Try it online! Returns 1 for odd numbers and 0 for even numbers. Two bytes shorter than the trivial lambda x:x%2 and one byte shorter than the equivalent magic...
Regex, 8 bytes [02468]$ Matches strings ending in one of 0, 2, 4, 6, 8. [13579]$ is equivalent but with opposite outputs. Try it on Regex101!
You might have noticed that challenges now show a leaderboard in addition to the table of contents. This is something this community has wanted for a while, and now, thanks to user contributions a...
Using your languages of choice, golf a quine - a non-empty program taking no input and only outputting its source. Here, the win condition is your quine working in the most languages. It should be...
Yes, including the fact that it's in C. Using a heading such as "C + BMPL" that links to the library and explains what it does should be fine. I also think that having a way to run it (preferably ...
Yes tips is a sort of prefix tag, and code-golf-tips is a superfluous tag. I think it it worth keeping them separate because tips is already very flexible.
Zsh, 8 bytes >$@ <^$1 Attempt This Online! Outputs via exit code: 0 for not all the same; 1 for all the same >$@: create a file named for each element in the input effectively de...
Since there have been some discussions about the use of GCC extensions, I decided to make a default-rules post about it. How should we deal with compiler extensions to languages?
Brain-Flak, 250 bytes ((((()()()){}){}){}()){(({})[()])}{}(<>)<>{({}<>)<>}<>{(({})[()])}([]){{}([(({}))](((()()()){}){}){}()){({}[()])<>((((()()()()){}){}){})&l...
Two words are anagrams of each other if the letters of one can be reordered to spell the other; e.g. ADOBE and ABODE are anagrams. An alternate way of describing it is that both words contain the s...
APL (Dyalog Unicode), 23 bytes Anonymous tacit prefix function. Reuires 0-based indexing (⎕IO←0) (⊢⍪⍨¯1↓⊢,∘↑-∘⍳∘≢↑¨⊢)⊢,⌽ Try it online! ⌽ reverse the argument ⊢, prepend the argument (…) ...
Credit This challenge is taken with permission from https://www.mysterytwisterc3.org/en/challenges/level-1/beaver-code Description The encryption method is as follows: The plaintext is divided ...
Jelly, 2 1 byte Z Try it online! -1 byte thanks to Razetime! Full program How it works Z - Main link. Takes a list L on the left Z - Transpose Implicitly print, smashing lists togethe...
APL (Dyalog Unicode), 33 bytes {×x←⊃(2⌷⍵)(÷⍨(/⍨)0=|)⍺×1⌷⍵:x∇⍵⋄⍺} Try it online! The first case doesn't work because it gets really big, but the other two do. The input is taken on the left a...
A Juggler sequence is a sequence that begins with a positive integer $a_0$ and each subsequent term is calculated as: $$a_{k+1} = \begin{cases} \left \lfloor a_k ^ \frac 1 2 \right \rfloor, &...
BQN, 17 bytesSBCS {𝕩∾1𝕊⍟≠⌊𝕩⋆2|𝕩+÷2} Run online! BQN primitives alone can't express unbounded iteration, so this must be a recursive block function. {𝕩∾1𝕊⍟≠⌊𝕩⋆2|𝕩+÷2} # Function 𝕊 taking argu...
Jelly, 7 bytes *Ḃ×½ḞµƬ *Ḃ×½ḞµƬ *Ḃ input ^ (input % 2) ×½ multiply sqrt(input) Ḟ floor µƬ iterate until converged and collect results Try it online!
Vyxal, 27 bytes QabcdefghijKlmnopqrstUvwxyz Try it Online! Works by exiting straight away. The joys of a language where every letter is a built-in function. Explained QabcdefghijKlmnopqrstUv...
None of these are applicable at least not for Code Golf challenges. I think this community should "opt out" of reactions unless we can come up with more relevant ones. "Works for me". Answers ...
The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line: The first number is the par of the specific hole. The second nu...
Many programming languages have the concept of keywords, special syntax items that are not just identifiers reserved by some library, but words reserved by the language itself. The challenge is to...
Inspired by this challenge. If anyone has any suggestions for a song title I could use for the challenge title then please leave a comment. Definition We define f(x) for a given integer as the su...
Well... maybe not in combination with a code golf challenge, but more like an artistic challenge with some theme, similar to screenshot of the month? For reference see for example Outdoors photo co...
Given a string and a non-negative integer $n$, output a new string in which each character is repeated $n$ times. Test cases: "abc", 1 -> "abc" "Hello", 0 -> "" "double", 2 -> "ddo...
Rational numbers in decimal representation can have an infinite periodic part. One common way to write this down is to repeat the periodic digits and then add three dots. Numbers without those thre...