Solution for Quick sort