# https://www.codingame.com/ide/puzzle/horse-racing-duals # Xavier Morel - 2016-03-12 # WIP: Only passing tests up to 55% : big performance issues, obviously... read N for ((i=0; i0)); then horses+=":" fi horses+=$Pi done echo $horses | tr ":" "\n" | sort -n | awk 'NR>1{print $1-p} {p=$1}' | sort -n | head -n 1