Medium · Arrays

Quick sort

Given an integer array nums, sort it in place into non-decreasing order with quicksort (partition around a pivot, then sort each side); the function returns nothing.

Examples

Example 1

[5, 2, 8, 1, 9, 3, 7]

Output: [1, 2, 3, 5, 7, 8, 9]

Example 2

[7, 6, 5, 4, 3, 2] · worst

Output: [2, 3, 4, 5, 6, 7]

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Arrays problems