Search
As you might know, there were elections in Germany, and now the parties have to form a government coalition. Let's help them with it! A good coalition has the strict majority of seats (that is, mo...
Haskell, 141 bytes import Control.Monad f a=map(map fst)$filter(\c->let{g=map snd;e=sum(g a)`div`2;f=g c;d=sum f}in d>e&&all((<=e).(d-))f)$filterM(pure[1<0..])a Try it ...
Run-length encoding is a simple compression technique which compresses sequences of repeating identical bytes. The encoding rules for this task are as follows: Any sequence of $n$ identical bytes...
Python 3, 106 91 bytes Saved 15 bytes thanks to Moshi in the comments lambda a,b,c:[p for p in"+ - * // % **".split()if(p in'+-**'or b)and eval(f"{a}{p}{b}")==c] Try it online!
Use higher versions of Java Seriously, it's crazy what sort of features have been added since Java 8. I hardly recognize the language anymore... Examples: Constructing Lists Before, you had to ...
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 ...
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[:...
Scala, 41 bytes x=>2 to x forall(d=>x%d+math.sqrt(d)%1>0) Try it online! Pretty straightforward
Python3, 39 bytes lambda n:all(n%i**2for i in range(2,n)) Try it online! Makes a list comprehension from the numbers 2 through n of the remainder of the square, and then checks whether the lis...
Vyxal, 4 bytes K∆²a Try it Online! Outputs 0 for square-free, 1 for not. K # Factors ∆² # Is perfect square a # Any true?
Ruby, 20 bytes ->a,b{4[a]*4[b]+a+b} Attempt This Online!
Python 3, 7 distinct characters, 11 bytes True/-~True Try it online!
J, 4 3 distinct, 6 bytes -:_-:_ Half of _ -: _ which is asks if infinity matches infinity. Thanks to @xash in the APL farm discord for saving the 3 unique bytes and orthoplex for catching my bl...
Perl, 3 distinct, 12 bytes s//yy//y/y// Try it online! Prepends yy to the start of $_, and then transliterates them, dividing the count of each.
Clojure - 15 characters total, 5 unique Inspired by the Embed ESCR solution above, I realized I could do something very similar in Clojure: (/(*)(+(*)(*))) This returns 1/2, which is a Ratio i...
Python 3, 5 unique bytes, 28 total (()==())/((()==())+(()==())) (, ), =, /, + Uses (()==()) to get True with only 3 unique characters, as well as making the later grouping of (...+...) free. ...
Ruby, 18 bytes loop{$><<$/=?*+$/} Try it online!
Challenge It's a bootstrapping challenge this time! Write a full program that, once run, writes the source code of another program that in turn, once run, writes the source code for another progra...
Challenge Given an array in any suitable format, create a frequency table for it. i.e: Pair each unique element with the number of times it appears in the array. You can return the frequency tabl...
Vyxal, 4 bytes ‡∑Ḋȯ Try it Online! Explained ‡∑Ḋȯ ‡ ȯ # Find the first input numbers where: ∑ # The sum Ḋ # Divides that number