Family Day update
This commit is contained in:
parent
aac6731f2c
commit
9ad63ea473
2442 changed files with 39761 additions and 8255 deletions
|
|
@ -0,0 +1,18 @@
|
|||
def sorted?(items : Array)
|
||||
prev = items[0]
|
||||
items.each do |item|
|
||||
if item < prev
|
||||
return false
|
||||
end
|
||||
prev = item
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
def permutation_sort(items : Array)
|
||||
items.each_permutation do |permutation|
|
||||
if sorted?(permutation)
|
||||
return permutation
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue