Search
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 ...
APL (Dyalog Classic), 31 bytes '#',{4=≢⍵:⍵[2 2 3 3 4 4]⋄6⍴1↓⍵} Try it online!
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...
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...
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...
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...
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...
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...
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...
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...
BQN, 27 bytes •math.GCD{∧´∘⥊(1=𝔽´)∧1<𝔽⌜˜} Booleans in BQN are the integers 0‿1. Try all test cases on the: BQN online REPL
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...
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...
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...
Taxi, 183 bytes Go to Writer's Depot:w 1 r 3 l 2 l."Hello, World!"is waiting at Writer's Depot.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.Go to Taxi Garage:s 1 l 1 l 2...
The process to create a small icon from a big one, is to not just reduce its resolution by a standard downsample, but to recreate the icon from scratch with gradually fewer details. As your downsam...
On main Codidact Meta there was a request for Unique favicons for each site. This has had a positive response and no objections (the nearest is one answer that says it should be opt in per communit...
JavaScript (V8), 185 bytes for(c=99;c;)print((f=(s=` on the wall`)=>`${c||99} bottle${~-c?`s`:``} of beer`+s)()+`, ${f``}. ${--c?`Take one down and pass it around`:`Go to the store and buy s...
Scala, 25 bytes a=>_.flatMap(a map _.min) Try it in Scastie! Pretty trivial solution, but here's a bad explanation anyway: //a is the first string a =>_.flatMap(a map _.min) //b is th...
Sclipting, (UTF-16) 80 bytes 갰減먩놔 먩놦①復먩놗겮꺕똀 먩놬①復①增疊먩놣겮꺕똀會먩놣겮꺕떠 먩놩⑴復먩놝 Explanation Input n pushed on stack 갰減 Subtract 3 먩놔 "╔" 먩놦 "╦" ①復 String of above repeat...
Jelly, 4 bytes X}€S Try it online! How it works X}€S - Main link. Takes n on the left, m on the right € - Over each element of 1 through n: } - With m as its argument: X - Y...
Vyxal ṪR, 3 bytes (⁰℅ Try it Online! ( # N times... ℅ # Generate a random integer between one and... ⁰ # First argument
Japt -mx, 3 bytes Takes n as the first input and m as the second. ÒVö Try it ÒVö :Implicit map of the range [0,first input) Ò :Negate the bitwise NOT of (i.e., increment) V ...
Haskell, 25 bytes f a=(>>= \c->map(min c)a) Try it online!
Python 3, 47 42 40 bytes -2 bytes thanks to bastolski lambda n:'#'*n+('\n#'+' '*(n-2)+'#')*~-n Try it online! Python's string multiplication is really useful.