Backend Engineer
Senior
programming
Implement the Quick Sort algorithm. The function should return the sorted array.
Example 1:
Input: arr = [10, 7, 8, 9, 1, 5]
Output: [1, 5, 7, 8, 9, 10]Example 2:
Input: arr = [3, 6, 8, 10, 1, 2, 1]
Output: [1, 1, 2, 3, 6, 8, 10]Constraints:
- 1 <= arr.length <= 1000
- -10^3 <= arr[i] <= 10^3.
Suggested Answer