17 votes

Upside-Down Pyramid Addition...REVERSED!

JavaScript (ES6),  62 58 49  46 bytes Saved 3 bytes thanks to @Oliver Returns the list as a comma-separated string. ...
user avatar
  • 165k
14 votes
Accepted

The fastest Sudoku solver

C++ - 0.201s official score Using Tdoku (code; design; benchmarks) gives these results: ~/tdoku$ lscpu | grep Model.name Model name: Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz ~/tdoku$ # ...
user avatar
  • 314
11 votes

Climbing the Bookshelf

Wolfram Language (Mathematica), 33 bytes dIf[Abs[#2-#]>d,0,1+#0@##2,0]& Try it online! Input [durability][heights...]. ...
user avatar
  • 15k
10 votes

The Original Number

Python 2, 121 117 115 bytes def g(s,a=0,f=''): for c in s: a+=34**ord(c)%43;r='P!\x83u\x8eI\x92|Z'.find(chr(a))+1 if r:f,a=f+`r`,0 return f -4 bytes: ...
user avatar
10 votes

Gerrymander North Carolina

C++, score = 33.526203, all test cases in 2min34s (of course, the score can be improved by running the program for more time; please do not do that to claim a victory or something) That score is ...
user avatar
  • 8,096
10 votes
Accepted

How quickly can you convert an NFA to a DFA?

Rust, score 15 in ≈ 6000 s Most of my optimization effort has actually gone into memory usage rather than speed, for reasons you can see in this table of results on my system (AMD Ryzen 1800X): ...
user avatar
9 votes
Accepted

Golfing Newton's Method

Golfed only, -23 bytes ES6 supports default parameters. Default function parameters allow formal parameters to be initialized with default values if no value or ...
user avatar
  • 165k
8 votes

Ethiopian Multiplication

Python 2, 203 202 187 133 bytes ...
user avatar
  • 19.7k
8 votes
Accepted

Ethiopian Multiplication

Charcoal, 91 bytes ≔⟦⟧τ≔⁰σNθNηWθ«⊞τ⪫ Iθ⊞υ⪫⎇﹪θ² ¦[]Iη≔⁺σ∧﹪θ²ησ≔÷θ²θ≔⁺ηηη»⊞υ…=⁺²LIσ⊞υ⪫ Iσ←E⮌τ⮌ιM⌈EυLιLυ←E⮌υ⮌ι Try it online! Link is to verbose version of code. ...
user avatar
  • 142k
8 votes

128 years? Hypothetical leap year reform

C (gcc), 60 bytes f(m,d,y){y-=m<3;return(y+y/4-y/128+"-bed=pen+mad."[m]+d)%7;} Try it online! Simple modification of Sakamoto's method. Takes input as ...
user avatar
  • 4,181
8 votes

Upside-Down Pyramid Addition...REVERSED!

Haskell, 22 bytes foldl(flip$scanr(-))[] Try it online!
user avatar
  • 137k
8 votes

There's an echo in my array... echo in my array... my array

MATL, 16 bytes t"GX@WQB&Y-~?w]x Try it online! Or verify all test cases. Explanation Polynomial division for the win! ...
user avatar
  • 99.3k
8 votes

Bridge the Gaps

Python, 2.62 * 10^40 This algorithm just floodfills (BFS) the plane starting from the black parts of the image, where for each new pixel we record what black part it was flooded from. As soon as we ...
user avatar
  • 42.9k
8 votes

The fastest Sudoku solver

Node.js, 8.231s 6.735s official score Takes the file name as argument. The input file may already contain the solutions in the format described in the challenge, in which case the program will ...
user avatar
  • 165k
7 votes

Number Triangles

Mathematica, 104 97 90 94 bytes {Grid[List@*Row/@#],#~Total~2}~Column~Right&[NestList[3-Mod[+##,3]&@@@Partition[#,2,1]&,#,9]]& Explanation ...
user avatar
  • 13.6k
7 votes

Upside-Down Pyramid Addition...REVERSED!

Haskell, 42 bytes f[]=[] f a=f(zipWith(-)a$tail a)++[last a] Try it online!
user avatar
  • 35.2k
7 votes

There's an echo in my array... echo in my array... my array

Haskell, 167 bytes First it is important to notice that if there is an echo present, then the input array is a convolution of another array with some array of the form ...
user avatar
  • 42.9k
7 votes

Bridge the Gaps

C, score 2.397x10^38 Man this took way too long to do, most likely due to my choice of language. I got the algorithm working fairly early, but ran into a lot of problems with memory allocation (...
user avatar
  • 2,006
7 votes

The fastest Sudoku solver

C - 0.045s unofficial score I got this time on my i7-9750H with 6 cores 12 threads @ 4Ghz. I'm aware that my cpu is faster than the i7-7700HQ so I think (hope) it would be closer to 0.080s if it were ...
user avatar
  • 71
7 votes

Climbing the Bookshelf

Octave / MATLAB, 37 35 bytes 2 bytes saved thanks to @Giuseppe! @(x,d)sum(cumprod(abs(diff(x))<=d)) Output is 0-based. Try it online!
user avatar
  • 99.3k
6 votes

The Original Number

Python 2,131 127 bytes s=input() for y in'WXGURFSOIZ':vars()[y]=s.count(y) while Z<9:s+=[O-U-W,W,R-U,U,F-U,X,S-X,G,I-X-G-F+U][Z]*str(Z+1);Z+=1 print s Try it ...
user avatar
  • 2,793
6 votes

128 years? Hypothetical leap year reform

Wolfram Language (Mathematica), 57 55 53 bytes DayName@{m=#~Mod~128;6+Mod[(9#-m)/8-6Clip@m,28],##2}& Try it online! Takes three inputs: the year, the month, ...
user avatar
  • 5,177
6 votes

Upside-Down Pyramid Addition...REVERSED!

TI-BASIC, 54 bytes Ans→L₁:dim(L₁→dim(L₂:While 1-Ans:L₁(Ans→L₂(Ans:-ΔList(L₁→L₁:dim(Ans:End:L₁(Ans→L₂(Ans:L₂ Input is the list of the right side of the triangle ...
user avatar
6 votes

Climbing the Bookshelf

JavaScript (ES7), 41 bytes -6 thanks to @emanresu A d=>f=([a,...x])=>(a-x[0])**2<=d*d&&-~f(x) JavaScript (ES7), 42 bytes ...
user avatar
6 votes

Climbing the Bookshelf

Vyxal, 7 bytes ¯ȧ<1JTh Try it Online! ...
user avatar
  • 26.8k
6 votes

Climbing the Bookshelf

Perl 5 + -pa, 40 bytes //,$\++while!eof&&"@F">=abs+($_=<>)-$'}{ Try it online! Explanation Thanks to ...
user avatar
6 votes

Climbing the Bookshelf

Emojicode, 272 bytes 🏁🍇💯🆕🔡👂🏼❗️❗️➡️d🎶🆕🔡👂🏼❗️❗️➡️l l➡️🖍🆕a 0➡️🖍🆕c🐨a 0❗️🔂v a🍇↪️🍺💯v❗️➖🍺💯🐽l c❗️❗️▶🙌🍺d🍇🚪🐇💻c❗️🍉c⬅️➕1🍉🚪🐇💻c❗️🍉 Try it ...
user avatar
  • 3,206
5 votes
Accepted

The Original Number

Jelly,  38  37 bytes ḟ“RGS”O“OX‘,“¢©“¢¢¤‘yF×4/%74ị⁽Gל?9¤Ḍ A monadic link taking a list of characters (the string) and returning an integer. Try it ...
user avatar
5 votes

The Original Number

Javascript (ES6), 288 150 144 bytes ...
user avatar
5 votes

The Original Number

PHP, 164 bytes ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible