New answers tagged sorting
2
votes
3
votes
Fix my FizzBuzz
Charcoal, 55 bytes
WS⊞υι⮌⊟ΦE⁷EEυ⁻⁺⌈EυΣ⁺ψνκμ∨⁺⎇﹪λ³ωFizz⎇﹪λ⁵ωBuzzIλ⬤ι⁼№ιλ№υλ
Try it online! Link is to verbose version of code. Explanation:
...
2
votes
Fix my FizzBuzz
05AB1E, 28 bytes
∞εD35SÖƶ(O‚0Kθ}Ig„üÿ.V.Δ{I{Q
Not too happy about this.. I have the feeling this can be a lot shorter.. :/
Try it online or verify all test cases.
...
3
votes
Fix my FizzBuzz
JavaScript (ES6), 82 bytes
Saved 2 bytes thanks to a suggestion by @emanresuA
Expects and returns -1 for Fizz, -2 for Buzz, <...
1
vote
11
votes
Fix my FizzBuzz
Vyxal, 21 15 bytes
ṖÞ∞ƛ₍₃₅T∨;ÞS$↔h
Try it Online!
Why use clever mathematics when you can just generate infinite FizzBuzz?
-6 thanks to Steffan and emanresuA
...
6
votes
Fix my FizzBuzz
J, 54 bytes
(-:&(/:~)"1#])#]\1((,~{~0=])2-@#.0=5 3|])@+#i.@+9>.>./
Try it online!
_1, _2, _3 represent Fizz, Buzz, FizzBuzz.
Generate all integers ...
2
votes
Implement the slowest possible sorting algorithm that retains a fast best case
Python 3, \$O\left(n^2\left(max\left(a\right)-min\left(a\right)+1\right)^{n-1}\right)\$
...
1
vote
Implement Sleep Sort
C (clang), 72 bytes
main(n){~scanf("%d",&n)?fork()?wait(main()):printf("%d ",n+sleep(n)):0;}
I chose clang but it also works on gcc.
...
3
votes
2
votes
Implement Sleep Sort
Rust, 125 bytes
Used the depricated sleep_ms function so I don't need to write a long duration.
...
1
vote
0
votes
Sort odd numbers first
Zsh, 31 bytes
grep [02468]$<i
grep [13579]$<i
Attempt This Online!
Takes input from a file called i.
3
votes
Reverse odd runs
Desmos, 94 93 bytes
g(M,j)=j-max([1...j]0^{mod(M,2)})
f(L)=L[[i+g(L[n...1],n+1-i)-g(L,i)fori=[1...n]]]
n=L.length
Try it on Desmos!
*-1 byte thanks to @AidenChow (...
1
vote
Reverse odd runs
Factor + grouping.extras, 62 bytes
[ [ odd? ] group-by [ last2 swap [ reverse ] when ] map-flat ]
Attempt This Online!
3
votes
Top 50 recent answers are included
Related Tags
sorting × 201code-golf × 168
array × 51
string × 36
number × 18
code-challenge × 18
sequence × 10
permutations × 10
integer × 8
restricted-complexity × 8
math × 6
popularity-contest × 5
random × 5
optimization × 5
natural-language × 5
ascii-art × 4
date × 4
matrix × 4
fastest-code × 4
path-finding × 4
stack × 4
arithmetic × 3
restricted-source × 3
combinatorics × 3
graph-theory × 3