Sort k increasing decreasing arrays