Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
This challenge is intended to be solved by sorting, ordering, or otherwise organizing some set of data.
2
votes
Worst case of Slowsort
Python 3, 42 bytes:
f=lambda n:n and-~f(n//2)+f(~-n//2)+f(n-1)
3
votes
Sorting passengers on a plane
Python3, 436 bytes:
R=range
C=lambda x:eval(str(x))
def f(n):
q,s=[O:=([0]*n,[*R(n,0,-1)],0)],[O[:-1]]
while q:
g,p,c=q.pop(0)
if sorted(p)==p and all(p):return c
Y=[]
for i in R(n):
for …
4
votes
In what order will the downloads complete?
Python3, 162 bytes
def f(F,p):
q,s=[],[]
F=sorted(F)
while F+q:
q+=[[F.pop()]*2for _ in F[:p-len(q)]]
Q=[]
for a,b in q:
if a:Q+=[(a-1,b)]
else:s+=[b]
q=Q
return s
Try it online!
1
vote
Fix my FizzBuzz
Python3, 276 bytes:
def v(r,l,k=[]):
if any([r,l])==0:yield k;return
for i,a in enumerate(l):
if a==r[0]or(type(a)==str and r[0]%{'Fizz':3,'Buzz':5,'FizzBuzz':15}[a]==0):yield from v(r[1:],l[:i]+l …