beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Quicksort Partition (First Value)

Geoffrey Challen // 2020.6.0

Create a method fun partition(value: IntArray?) that returns the input array partitioned using the first array value as the pivot. All values smaller than the pivot should precede it in the array, and all values larger than or equal to the pivot should follow it. Your method should return the index of the pivot value. If the array is null or empty you should return -1.