Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started