human
Split array into K subsets to maximize their sum of maximums and minimums | Function that prints the maximum sum possible.
Find elements in each group.
Sort all elements in non - descending order.
Add K largest elements.
For sum of minimum elements from each subset.
Printing the maximum sum.
Driver code"
Solution in Python:

=====
Give me a code to split array into K subsets to maximize their sum of maximums and minimums and the other steps required?
assistant
#Here is code to split array into K subsets to maximize their sum of maximums and minimums and the other steps required.
 def maximumSum ( arr , n , k ) :
	elt = n // k ;
	sum = 0 ;
	arr . sort ( ) ;
	count = 0 ;
	i = n - 1 ;
	while ( count < k ) :
		sum += arr [ i ] ;
		i -= 1 ;
		count += 1 ;
	count = 0 ;
	i = 0 ;
	while ( count < k ) :
		sum += arr [ i ] ;
		i += elt - 1 ;
		count += 1 ;
	print ( sum ) ;
if __name__ == ' _ _ main _ _ ' :
	Arr = [ 1 , 13 , 7 , 17 , 6 , 5 ] ;
	K = 2 ;
	size = len ( Arr ) ;
	maximumSum ( Arr , size , K ) ;