New answers tagged sorting
1
vote
Help, I've mixed my week up!
Uiua, 6 bytes
↻1Days
Boring builtin answer (Days starts with "Sunday", so it ...
0
votes
Help, I've mixed my week up!
AWK, 63 bytes
$0=gensub(/X/,"day ","g","MonXTueXWednesXThursXFriXSaturXSunX")
Attempt This Online!
0
votes
Code Golf: Mix the nuts so that none of the same kind are touching
Uiua, 19 bytes
⍣⊢∘▽/↧⧈≠⍉.⧅≠⊸⧻
Try it!
...
1
vote
In what order will the downloads complete?
Pip, 19 bytes
YOGb{Y[a]+SNy}SKDNa
Attempt This Online! Port of several other golflang answers, posted by DLosc's request (-2 thanks to DLosc).
...
1
vote
In what order will the downloads complete?
Uiua, 17 bytes
F ← ⊏⍏◌⤚∧˜(.⍜⊢+⍆)⊙⊚⇌⍆
Try it online!
This would be 16 bytes with F ← ⊏⍏⊸⬚∘\(⍜⊢+⍆)⊚:⇌⍆ if the ...
2
votes
In what order will the downloads complete?
Pip -xp, 44 bytes
Wl|DN:a#l<b&a?uPU[i0]+@YlPUPOaUi&FI:DlBMUSNu
Attempt This Online!
Ungolfed/commented
This solution ...
3
votes
In what order will the downloads complete?
05AB1E, 16 14 bytes
Å0©I{RΣ®{ćy+š©
Port of @emanresuA's Vyxal answer, which in turn is a port of @Albert.Lang's Python answer, so make sure to upvote both of those ...
5
votes
In what order will the downloads complete?
K (ngn/k), 28 27 bytes
{y@<(&x){-':y+\x@<x}\y@:>y}
Try it online!
Port of emanresu A's Vyxal solution.
...
9
votes
In what order will the downloads complete?
Python, 80 bytes
Thanks @att for -3
lambda l,p,S=sorted:S(l,key={x:(p:=[min(p)+x]+S(p)[1:])for x in S(l)[::-1]}.get)
Attempt This Online!
Previously, cleaner but ...
6
votes
In what order will the downloads complete?
Python 3.8 (pre-release), 115 113 109 bytes
-2 thanks to UnrelatedString
-4 thanks to xnor
...
9
votes
In what order will the downloads complete?
Vyxal, 22 12 11 bytes
ẋ£sṘµw¥s+:£
Try it Online!
Now uses an idea stolen from Albert.Lang's Python answer of only maintaining a list of queue lengths, and sorting ...
4
votes
In what order will the downloads complete?
Jelly, 15 14 12 11 bytes
ṢUṢ+"¥ɼÞɓxɼ
Try it online!
-1 with slightly less stateful register use
-2 by actually porting directly
-1 by thinking
Takes the list ...
4
votes
In what order will the downloads complete?
C (clang), 118 bytes
with -Wl,-z,execstack flags by @ceilingcat
...
3
votes
In what order will the downloads complete?
JavaScript (Node.js), 97 bytes
(x,t=0,h=[])=>g=n=>h[t]||n--?x+x?g(n,h[t+(u=x.sort((a,b)=>a-b).pop(t+=!!t))]=u):h.flat():g(0,++t)
Try it online!
-6B ...
4
votes
4
votes
In what order will the downloads complete?
Charcoal, 54 bytes
≔⟦⟧υW⁻θυ⊞υ⌈ιUMυ⟦ιι⟧Wυ«W⌊⌊υF⎇›Lυη…υηυUMλ⁻μ¬νI✂⌊υ¹≔Φυ⌊κυ
Try it online! Link is to verbose version of code. Explanation:
...
4
votes
In what order will the downloads complete?
JavaScript (ES6), 146 bytes
Expects (array)(n) and returns a space-separated string.
Probably not the shortest algorithm.
...
17
votes
In what order will the downloads complete?
Bash + GNU parallel, 69 bytes
+1 byte (nice): Neil points out sort needs -n, otherwise 100<11
...
Top 50 recent answers are included
Related Tags
sorting × 218code-golf × 183
array × 55
string × 40
code-challenge × 19
number × 18
sequence × 10
permutations × 10
restricted-complexity × 9
integer × 8
math × 6
natural-language × 6
popularity-contest × 5
random × 5
optimization × 5
ascii-art × 4
decision-problem × 4
date × 4
matrix × 4
fastest-code × 4
path-finding × 4
stack × 4
data-structures × 4
arithmetic × 3
combinatorics × 3