Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,26 @@
import algorithm
proc pancakeSort[T](list: var openarray[T]) =
var length = list.len
if length < 2: return
var moves = 0
for i in countdown(length, 2):
var maxNumPos = 0
for a in 0 .. <i:
if list[a] > list[maxNumPos]:
maxNumPos = a
if maxNumPos == i - 1: continue
if maxNumPos > 0:
inc moves
reverse(list, 0, maxNumPos)
inc moves
reverse(list, 0, i - 1)
var a = @[4, 65, 2, -31, 0, 99, 2, 83, 782]
pancakeSort a
echo a