solution for hackerrank - insertion sort with prints