+ 1

# Two arrays, A , B, of equal size. Find minimum value of A[0] * B[0] + A[1] * B[1] +…+ A[N-1] * B[N-1], where shuffling of eleme

I used permutations nd product libraries but exec timed out, also that was obv a direct unnecessarily memory nd time consuming code https://code.sololearn.com/cSCcpV70akiE/?ref=app

3 ответов

+ 1

so please describe the problem in future more detailed.)) you need rhe minimal sum of 2 arrays elements multiplication.
vheck my code
https://code.sololearn.com/cpU4sf3Tq08O/?ref=app
the algorithm is very easy. the min value of sum(ai*bj) all variants is following
1 array sprt ascending, second descending multiply elements and sum)

+ 1

First of all you need write the wiki, read some other sources.
Also you need read book and internet sources about algorithms and practice practice practice.
So in future you will begin to think more widely

0

Ok.. Sorry for lack of info, nd thanks for the soln. Cud pls tell me how to reach in such conclusions or algorithm when given a problem like this