Question: Aeasthertic permukation Problem Description Nir Hole has an array A of size N and an integer B gifted to him by Mrs Hola. The Aesthetic

 Aeasthertic permukation Problem Description Nir Hole has an array A of

size N and an integer B gifted to him by Mrs Hola.

The Aesthetic Vatue of the arrioy is defined as the sumtration of

[Ai]A[i+B] for all i from 1 to NB. You need to find

Aeasthertic permukation Problem Description Nir Hole has an array A of size N and an integer B gifted to him by Mrs Hola. The Aesthetic Vatue of the arrioy is defined as the sumtration of [Ai]A[i+B] for all i from 1 to NB. You need to find the minimum Aesthetic value possible for any permutation of the array A. Problem Constraints 2N31051Bmin(5000,N1)109A[i]109 Input Format The first argument given is an array, A. Input Format The first argument given is an array, A. The second argument given is an integer, B. Output Format: Return an integer denoting the minimum possible Aesthe Example Input Input 1: A=[4,3,4,3,2,5]B=3 Input 2 A=[3,5,3,5,3]B=2 Explanation 1: Consider the permutation of A=[2,3,4,4,3,5]. For this permutation : 24+33+45=3. And we possible for any permutation of A. Explanation 2: Consider the permutation of A=[3,5,3,5,3]. For this permutation: 33+5+5+33=0. And we possible for any permutation of A. You only need to implement the given function. Do ne question? Check out Sample Codeftr for more details. long Solution: : solve(vector \&A, int b)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!